Solvedmicrosoft authentication library for js User cannot log out

I'm submitting a...

  • Bug report


  • Chrome version XX
  • Edge version

Library version

Library version: 1.0.1

Current behavior

  1. Use clicks logout. App uses MSAL logout() to redirect to:

Sometimes, AD stops at this page and asks the user to select which account they should log out of. Other times, it blows right past it and automatically redirects to the next page.

  1. Page redirects (on AAD/B2C side) to:

Notice the post_logout_redirect_uri WAS in the first page, but is now gone. MSAL seems to be doing its part, but something gets lost during this redirect on the identity provider.


The page stays there with the message "You signed out of your account. It's a good idea to close all browser windows". The user has no way to return to the app.

  1. Manually browse back to the app.

  2. User does not appear to be logged in. A request is sent to:
&scope=profile openid offline_access user_impersonation

Which returns with the following from the hidden iFrame injected by MSAL:
"Loading frame has timed out after: 6 seconds for scope profile openid offline_acces"

And the following from a manual call to MSAL acquireTokenSilent():
"Token renewal operation failed due to timeout."

This is okay. I'd expect these to fail.

  1. User clicks login button. App calls MSAL loginRedirect(). Page redirects to:
&scope=profile openid offline_access user_impersonation

User is NOT promped for credentials. They are authenticated and automatically redirected back to the app.

Expected behavior

  1. I expect the user to not have to select what account they want to log out of when they are only logged in with 1 account.
  2. I'd expect them to get redirected back to the app.
  3. I'd expect them to have to provide username and password after they appear to have been logged out in already.


  • I am working with Azure support on this as well, but so far they have seen nothing incorrectly configured on the B2C or Azure end. I decided to post it here in case there is something library related that will help.
  • If the user closes and reopens the browser, they are fully logged out.
  • Before clicking Login and skipping the credentials, there are no cookies or any info stored locally. I have no idea how it is bypassing the credential prompt.
47 Answers

✔️Accepted Answer

For anyone who is stumped on this and finds this thread, I found a solution.

Similar to how you have to explicitly set your clientApplication authority before you redirect to login

this.clientApplication.authority = https://${msalTenant}${msalTenant}${msalSignInPolicy}; this.clientApplication.loginRedirect();

You have to explicitly set this before triggering logout, otherwise you are directed to the common MS online logout page.

this.clientApplication.authority = https://${msalTenant}${msalTenant}${msalSignInPolicy}; this.clientApplication.logout();

I figured this out by examining the network call to openid-configuration when the login process is triggered. This comes back with an object that has the property end_session_endpoint which matches the URL pattern above.

In the source code for logout it looks for an end session endpoint and if it doesnt exist, redirects you to common login online for logout. Where your redirect URI is not configured and it breaks.

Set the client application authority before logging out.
Set the logout redirect uri as a reply URL in your azure B2C application configuration.

Other Answers:

I published the recorded steps so you can see:

Related Issues:

microsoft authentication library for js Invalid Issuer (iss: when acquiring token
I believe this is a configuration issue in the Azure AD App Registration I'm submitting a.. ...
microsoft authentication library for js B2C Token endpoint CORS
We appreciate everyone's patience I certainly understand the frustration Please follow the issue tem...
microsoft authentication library for js Getting A silent sign-in request was sent but no user is signed in in multiple app sign-in environment
@jmckennon . Might not be related to this but after this issue is been closed Please follow the issu...
microsoft authentication library for js Sample Code for Angular 8 (msal-angular)
@stevenruizhang @jaleleddineagrebi @Choran66 There is a new beta for MSAL Angular with rxjs 6 suppor...
microsoft authentication library for js Preventing 3rd Party Cookies block when using MSAL Angular (1.x)
@jo-arroyo Thanks for getting back to me This is a big issue for us Looking at the MSAL.js 2.0 sampl...
microsoft authentication library for js acquireTokensilent return null accessToken randomly.
@mmuarc What I did was: Clone the project Switch to the branch Run npm install and npm run build in ...
microsoft authentication library for js User cannot log out
For anyone who is stumped on this and finds this thread I found a solution I'm submitting a.. ...