MSAL popup logout probem with my postLogoutRedirectUri

52 Views Asked by At

I would like to use the postLogoutRedirectUri page to clear all local storage elements in my application.

After the user logged out (via popup logout), in the popup there is a redirection to my post logout page but before it's loaded, the popup is automatically closed and my local storage is not clear.

It's a good practice to clear my local storage in the post logout page ?

  • If yes, how can I avoid the popup to close before my page is loaded ?
  • If no, what is the best practice to clear my local storage ?

My msalConfig

export const msalConfig: Configuration = {
  auth: {
    clientId: "1234",
    authority: "https://login.microsoftonline.com/abcd",
    redirectUri: "/blank",
    postLogoutRedirectUri: "/logout-callback",
    clientCapabilities: ["CP1"],
  },
  cache: {
    cacheLocation: BrowserCacheLocation.LocalStorage,
    storeAuthStateInCookie: isIE,
  },
};

My logout-callback component

export class LogoutCallBackComponent {

  constructor() {
    this.clearData();
  }

  clearData(): void {
    localStorage.removeItem('userInfo');
    localStorage.removeItem('tenantInfo');
    localStorage.removeItem('t_permissions');
  }
}

P.S : just to test, I set pollIntervalMilliseconds to 5000 and my page has the time to load and the cache is cleared (but it's clearly not the good solution)

0

There are 0 best solutions below