question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Library

  • @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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kd-ricardo-tavarescommented, Feb 16, 2021

The interaction_in_progress field should be cleared when a new tab is made since we store this in the sessionStorage

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#L41

https://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?

0reactions
prkhandelwalcommented, Feb 25, 2021

I can confirm what @kd-ricardo-tavares has mentioned. We are observing a similar behavior. Is there any update on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

BrowserAuthError: interaction_in_progress: Interaction is ...
Please ensure that this interaction has been completed before calling an interactive API. import * as msal from "@azure/msal-browser"; const ...
Read more >
BrowserAuthError: interaction_in_progress - Unable to fix ...
Please ensure that this interaction has been completed before calling an interactive API. For more visit: aka.ms/msaljs/browser-errors.
Read more >
interaction_in_progress" in SPA with MSAL redirect and iframe
BrowserAuthError : interaction_in_progress: Interaction is currently in progress. Please ensure that this interaction has been completed ...
Read more >
Interaction is currently in progress with azure/msal-browser ...
Coding example for the question BrowserAuthError: interaction_in_progress: Interaction is currently in progress with azure/msal-browser@2.11.2-Reactjs.
Read more >
BrowserAuthError | microsoft-authentication-libraries-for-js
Create an error thrown when requesting a token directly from the native platform with an unsupported prompt parameter e.g. select_account, login or create ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found