I'm using ADAL library in Agular2 project to authenticate user against Azure AD, once user authenticated calling WebAPI to get some information using REST call. All these working fine with AngularJS-AzureAD-WebAPI scenario.
Followed MS article to create a sample project https://blogs.msdn.microsoft.com/premier_developer/2017/04/26/using-adal-with-angular2
WebAPI receiving calls sfrom Angular2 project but, request has authorization token as anonymous. After futher reasearch, realized that JWT missing appid value and also aud property holds GUID which is Application ID.
Working Call JWT: (AngularJS to WebAPI)
appid: GUID for native application registered in Azure
aud: someone.onmicrosoft.com/CortanaWebAPI
Not working call JWT: (Angular2 to webAPI)
appid: no entry for this property
aud: GUID for native application registered in Azure
adal configuration
const endpoints = {
“https://localhost:44383/”: “http://someone.onmicrosoft.com/CortanaWebAPI”
};
public get getAdalConfig(): any {
return {
tenant: ‘someone.onmicrosoft.com’,
clientId: ‘9d9cd8dd-087a-4e87-b3f9-6e7ded2b5e82’,
redirectUri: window.location.origin + ‘/’,
postLogoutRedirectUri: window.location.origin + ‘/’,
endpoints: endpoints
};
}
Not sure why this is happening, any help appreciated.