Interactive state still set in session storage on logoutRedirect
See original GitHub issueCore Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
2.28.3
Wrapper Library
Not Applicable
Wrapper Library Version
None
Public or Confidential Client?
Public
Description
After upgrade from version 2.21.0 to 2.28.3. I’m unable to login again after logoutRedirect is called and browser is redirected to the login page. I see in the browsers session storage the key msal.interaction.status
is set, On removal I can then login again.
I have a gif showing this issue but has private information shown, Please let me know if it would be of use to share with you.
Error Message
{
"errorCode": "interaction_in_progress",
"errorMessage": "Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. For more visit: aka.ms/msaljs/browser-errors.",
"subError": "",
"name": "BrowserAuthError"
}
Msal Logs
No response
MSAL Configuration
{
auth: {
clientId: `${AUTH_CLIENT_ID}`,
authority: `${AUTH_AUTHORITY_URI}/${AUTH_TENANT_ID}`,
redirectUri: `${window.location.origin}/Redirect`,
postLogoutRedirectUri: `${window.location.origin}`,
},
cache: {
cacheLocation: BrowserCacheLocation.SessionStorage,
storeAuthStateInCookie: false,
},
}
Relevant Code Snippets
public logout(): Promise<void> {
return this._client.logoutRedirect({ account: this.activeAccount });
}
Reproduction Steps
- Login to app using loginPopup
- Logout using logoutRedirect
- Attempt to login again using loginPopup (Receive error above)
Expected Behavior
Able to login again after returning to the login page.
Identity Provider
Azure B2C Basic Policy
Browsers Affected (Select all that apply)
Chrome, Firefox, Edge
Regression
@azure/msal-browser 2.28.3
Source
External (Customer)
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Single-page application: Sign-in and Sign-out - Microsoft Learn
Sign-out with a redirect. MSAL.js provides a logout method in v1, and logoutRedirect method in v2 that clears the cache in browser storage...
Read more >BrowserAuthError: interaction_in_progress: Interaction is ...
Looks into session storage for key msal.[clientId].interaction.status and other temp values required for redirection process.
Read more >Window.sessionStorage - Web APIs - MDN Web Docs
The read-only sessionStorage property accesses a session Storage object for the current origin. sessionStorage is similar to localStorage; ...
Read more >okta-auth-js/README.md at master - GitHub
Returns the stored URI string stored by setOriginal. An OAuth state parameter is optional. If no value is passed for state , the...
Read more >PublicClientApplication | microsoft-authentication-libraries-for-js
Silently acquire an access token for a given set of scopes. ... a user account is added or removed from localstorage in a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I’m realising now that I’m missing a call to
handleRedirectPromise
in my init function which I see now in these docs https://learn.microsoft.com/en-gb/azure/active-directory/develop/msal-js-initializing-client-applications#initialize-msaljs-2x-appsMy original implementation was based of this repo: https://github.com/Azure-Samples/ms-identity-javascript-react-spa-dotnetcore-webapi-obo/blob/master/ProfileSPA/src/utils/authProvider.js#L36
Which only calls the
handleRedirectPromise
if its used in Internet Explorer. I wonder was there a change to the logic since 2.21.0+ ? Any way I think I have that in hand now, just need to refactor the init function to ensurehandleRedirectPromise
is called before app is ready!Thanks for you help Hector!
@eglavin thanks for raising this issue. I’ll start investigating and update you when I can reproduce this behavior.