Entra Id - OpenID Single Sign Out

Malvaro 145 Reputation points
2024-02-14T16:03:48.74+00:00

Hi MS Team, I am creating a React Frontend project with 3 internal applications. Each application has a specific App Registration and I am using the MSAL library for the Single Sign On (OpenID). By default, when I have logged in one application the rest of the apps I will have an automatic token and I am "simulating" a SSO behaviour. However, when I am logging out from one application the rest of them I am still having the session active. My question is: Do we have a way to destroy all sessions of all applications for the user simulating the Single Sign Out? or Do we need to implement something manually to have this result? Thank you in advance, Cheers, Moisés.

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

Accepted answer
  1. Navya 20,180 Reputation points Microsoft External Staff Moderator
    2024-02-15T10:16:13.86+00:00

    Hi @Malvaro

    Thank you for posting this in Microsoft Q&A.

    I understand you want to know the way to destroy all sessions of all applications for the user simulating the Single Sign Out.

    One way to implement SSO is to use OpenID Connect front-channel logout feature. This feature allows an application to notify other applications that the user has logged out. When the user logs out of one application, the application sends a logout request to all other applications that the user has logged into. The other applications then log the user out as well.

    To implement front-channel logout, you need to register the logout endpoints for all your applications with Azure AD Application registration

    Add code to your application that listens for logout requests from other applications and logs the user out when a request is received. Sign-out behavior on browsers

    Below is the sample code for SPA application.

    const config = {
      auth: {
        clientId: "your_app_id",
        redirectUri: "your_app_redirect_uri", //defaults to application start page
        postLogoutRedirectUri: "your_app_logout_redirect_uri",
      },
    };
    const myMsal = new PublicClientApplication(config);
    // you can select which account application should sign out
    const logoutRequest = {
      account: myMsal.getAccountByHomeId(homeAccountId),
    };
    myMsal.logoutRedirect(logoutRequest);
    
    
    

    For your reference: https://curity.io/resources/learn/openid-connect-logout/

    Hope this helps. Do let us know if you any further queries.

    Thanks,

    Navya

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.