When working on a local copy of our Angular application we need to access the api on the dev server. However since upgrading to using msal-angular this does not work anymore, it returns 401 and goes into a redirection loop.
I'm not sure if there is a configuration we are missing to allow this to work. It worked fine when we were using adal but we need V2 tokens on the api now.
export const protectedResourceMap: [string, string[]][] = [
['https://graph.microsoft.com/v1.0/me', ['user.read']]
];
...
imports: [
MsalModule.forRoot({
clientID: 'Azure-App-Id',
authority: 'https://login.microsoftonline.com/Azure-Tenant-Id',
validateAuthority: true,
redirectUri: window.location.origin,
navigateToLoginRequestUrl: false,
cacheLocation: 'localStorage',
popUp: false,
protectedResourceMap: protectedResourceMap
})
],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: MsalInterceptor, multi: true }
],
...
The above is my configuration in app.module.ts.
This works fine when I run my angular application from http://localhost:4200 against my asp.net core web api run from visual studio on https://localhost:5600.
It also runs fine when deployed on the server. However if I change the Angular app in dev environment to use the servers api (http://localhost:4200 -> https://www.api.azurewebsite.net), we always get authentication errors as the Angular app does not send the bearer token like it does on the other two cases.
Hopefully this is enough details.
Thank you.