Getting "BrowserAuthError: interaction_in_progress: Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API." on opening login page in new tab.
See original GitHub issueLibrary
-
@azure/msal-browser@2.11.1
Framework
- React
Description
Repro steps:
- Launch site (The B2C login page appears)
- Close the tab without logging in
- Open the site in new tab
- The B2C login page doesn’t open. Below mentioned error is recorded in Console logs.
The error is thrown at
await this.msalClient.loginRedirect({ scopes: this.loginScopes });
Error Message
Stack Trace:
index.js:2177 BrowserAuthError: interaction_in_progress: Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. at BrowserAuthError.AuthError [as constructor] (https://localhost:44307/static/js/bundle.js:1285:24) at new BrowserAuthError (https://localhost:44307/static/js/bundle.js:7827:28) at Function…/node_modules/@azure/msal-browser/dist/index.es.js.BrowserAuthError.createInteractionInProgressError (https://localhost:44307/static/js/bundle.js:7888:16) at PublicClientApplication…/node_modules/@azure/msal-browser/dist/index.es.js.ClientApplication.preflightInteractiveRequest (https://localhost:44307/static/js/bundle.js:11304:36) at PublicClientApplication.<anonymous> (https://localhost:44307/static/js/bundle.js:10674:45) at step (https://localhost:44307/static/js/bundle.js:836:23) at Object.next (https://localhost:44307/static/js/bundle.js:817:53) at https://localhost:44307/static/js/bundle.js:810:71 at new Promise (<anonymous>) at __awaiter (https://localhost:44307/static/js/bundle.js:806:12) at PublicClientApplication…/node_modules/@azure/msal-browser/dist/index.es.js.ClientApplication.acquireTokenRedirect (https://localhost:44307/static/js/bundle.js:10659:16) at PublicClientApplication.<anonymous> (https://localhost:44307/static/js/bundle.js:11566:44) at step (https://localhost:44307/static/js/bundle.js:836:23) at Object.next (https://localhost:44307/static/js/bundle.js:817:53) at https://localhost:44307/static/js/bundle.js:810:71 at new Promise (<anonymous>) at __awaiter (https://localhost:44307/static/js/bundle.js:806:12) at PublicClientApplication…/node_modules/@azure/msal-browser/dist/index.es.js.PublicClientApplication.loginRedirect (https://localhost:44307/static/js/bundle.js:11563:16) at Auth._callee$ (https://localhost:44307/static/js/bundle.js:487648:56) at tryCatch (https://localhost:44307/static/js/bundle.js:375584:40) at Generator.invoke [as _invoke] (https://localhost:44307/static/js/bundle.js:375818:22) at Generator.prototype.<computed> [as next] (https://localhost:44307/static/js/bundle.js:375636:21) at step (https://localhost:44307/static/js/bundle.js:487436:191) at https://localhost:44307/static/js/bundle.js:487436:361
Expected behavior
The application should redirect to B2C login page.
Identity Provider
- Azure AD B2C
Browsers/Environment
Tested and Microsoft Edge and Google Chrome.
Regression
- Did this behavior work before? This was working fine in Version: 2.7.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top GitHub Comments
We found that the issue was caused by a cookie with the
interaction_in_progress
value so this raised a flag. I must admit I didn’t go too deep into the code but this should be the right place: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/a58a54972e89cd85abd23a8ad1af4fe1309b989a/lib/msal-browser/src/interaction_handler/RedirectHandler.ts#L41https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/a58a54972e89cd85abd23a8ad1af4fe1309b989a/lib/msal-browser/src/cache/BrowserCacheManager.ts#L439
When
storeAuthStateInCookie
is true you also store the state in a cookie.I went and tested and surely enough when I set it to false I don’t get the issue anymore.
On a side note, according to this page setting
storeAuthStateInCookie
to true fixes an issue with Edge and IE. Our product needs to support Edge but reading that page it isn’t clear if the bugs still exist in the current version or not (the links to the issues are broken).Do we still need to set this flag if we don’t support IE?
I can confirm what @kd-ricardo-tavares has mentioned. We are observing a similar behavior. Is there any update on this issue?