79752879

Date: 2025-09-01 20:15:23
Score: 1
Natty:
Report link

Okay I finally got this working after following the first answer by @vangj

The issue is some default scopes like 'openid' do not return an accessToken. I found this out by implementing a manual SSO function and some googling. (this is the only one I had defined)

You need to create a custom scope and expose your API for the 'accessToken' to return within the microsoft interceptor config.

So make sure your protected resource scopes has a scope included that will indeed return an accessToken. (openid will not)

export function MSALInterceptorConfigFactory(): MsalInterceptorConfiguration {
  const protectedResourceMap = new Map<string, Array<string>>();
 protectedResourceMap.set ( // This triggers automatic silentSSO 
    environment.apiUrl, //your app will try to get a token if protected resource gets called
    ['openid', 'https://yourapi.onmicrosoft.com/{clientid}/App.Access'] // You need a custom application scope and expose an API, in order to get 'accessToken' to return, if not it will be empty and fail.
  ); 
  return {
    interactionType: InteractionType.Redirect,
    protectedResourceMap,
  };
}
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • User mentioned (1): @vangj
  • Low reputation (1):
Posted by: Rudy V