MSAL Azure Library after logout redirect login issue on multiple tab

Gulati, Sneha S 5 Reputation points
2024-02-12T21:49:27.7233333+00:00

Hi Team, We are facing issue while setting up MSAL configuration in SPA. When we logging out after idle timeout ( set up idle browser timeout for logging out )while app is opened in multiple tab, only logout redirect happening to the tab which is getting executed first, for other tabs its just stuck at logout page. Thanks

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. James Hamil 27,221 Reputation points Microsoft Employee Moderator
    2024-02-13T19:22:11.6733333+00:00

    Hi @Gulati, Sneha S , this issue might be related to the way MSAL handles the logout process. When you log out, MSAL clears the cache and redirects the user to the Azure AD sign-out page. After sign-out, Azure AD redirects back to the page that invoked logout by default. However, if the user has multiple tabs open, the logout process might not work as expected. To resolve this issue, you can try the following steps:

    1. Use the logoutPopup method instead of the logoutRedirect method. The logoutPopup method opens a popup window for the logout process, which allows the user to log out from all tabs.
    2. You can also try setting the account parameter to null when calling the logoutRedirect method. This will log out the user from all accounts and clear the cache.
    3. Another option is to use the endSessionRequest method to end the user's session. This method sends a request to the Azure AD endpoint to end the user's session and clears the cache.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you, James


  2. Ronak Soni 0 Reputation points
    2024-06-02T09:57:49.16+00:00

    Hello @Gulati, Sneha S Have you resolved the issue?

    Also, I have one another issue, when token time expiration, or if user come back after next day, then it is going to first logged out and then it is stuck at the logged out page instead of loggin page.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.