Azure-Samples/ms-identity-javascript-angular-spa-aspnetcore-webapi

Logout is not working properly

Shyam268 opened this issue · 3 comments

Packages Used:
"msal": "^1.3.4",
"@azure/msal-angular": "^1.0.0",
issue:
User cannot logout it struct at logout session page:
image

Code to reproduce:
appsetting.json

{
  "appsettings":{
     "authentication":{
      "authority": "https://login.microsoftonline.com/tenentId",
      "clientId":"1112222-2232-235456-21311",
      "cacheLocation": "localStorage"
      },
      "Service1":{
         "url" : "https://localhost:5001",
         "scope"  : ["https://{mytenent}.onmicrosoft.com/1231-321313-13233311/CRUD"]
      },
      "redirectUri":"http://localhost:4200/",
      "postLogoutRedirectUri": "http://localhost:4200/",
  }
}

msalConfig.ts


export function MSALConfigFactory(config: AppConfigService): Configuration {
  const appSettings = config.getConfig(config.APP_SETTINGS);
  const authentication = appSettings.authentication;
  const auth = {
      auth: {
          clientId: authentication.clientId,
          authority: authentication.authority,
          redirectUri: appSettings.redirectUri,
          postLogoutRedirectUri: appSettings.postLogoutRedirectUri,
          navigateToLoginRequestUrl: true,
          validateAuthority: true,
      },
      cache: {
         cacheLocation: 'localStorage'
      }
  };
  return (auth as Configuration);
}

logoutComponet.ts
logout() {
this.authService.logout();
}

app registration settings:

image

i am able to call web api but logout not working properly

if i change the authority " "authority": "https://login.microsoftonline.com/common/", logout works. i am not able to call the web apis. throws "Token renewal operation failed due to timeout"

@Shyam268 I was not able to reproduce this. Is there a specific browser that you're having this issue with? Any other details? Also, did you try updating your msal.js and msal-angular packages?

You shouldn't change your authority to common in the app if you registered your app as a single-tenant.

Looks like the issue is being discussed here. Closing this as duplicate.