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.

Login fails with interaction_in_progress error

See original GitHub issue

Core Library

MSAL.js v2 (@azure/msal-browser)

Core Library Version

2.18.0

Wrapper Library

Not Applicable

Wrapper Library Version

None

Description

Eventhough, handleRedirectPromise is the first thing that happens in our SPA app, interaction_in_progress is thrown when logging-in.

storeAuthStateInCookie is set to true.

This is the cookie I see in Chrome’s dev tools: image

Error Message

(with verbose logs enabled) image

Msal Logs

MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Verbose - handleRedirectPromise called MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Verbose - getAllAccounts called MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getIdTokenCredential: cache hit MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getAccessTokenCredential: cache hit MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getRefreshTokenCredential: cache hit MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getAccessTokenCredential: cache hit MsalPublicClientApplicationConfig.ts:37 msal: 2: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Info - Emitting event: msal:handleRedirectStart MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Verbose - handleRedirectPromise has been called for the first time, storing the promise MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getTemporaryCache: No cache item found in local storage MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : [2ef17b53-b723-4562-932d-a253ca219c99] : msal.js.browser@2.18.0 : Verbose - initializeServerTelemetryManager called MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : [2ef17b53-b723-4562-932d-a253ca219c99] : msal.js.browser@2.18.0 : Verbose - getRedirectResponseHash called MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getTemporaryCache: No cache item found in local storage MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : [2ef17b53-b723-4562-932d-a253ca219c99] : msal.js.browser@2.18.0 : Verbose - Hash does not contain known properties, returning cached hash MsalPublicClientApplicationConfig.ts:37 msal: 2: [Thu, 25 Nov 2021 03:06:42 GMT] : [2ef17b53-b723-4562-932d-a253ca219c99] : msal.js.browser@2.18.0 : Info - handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache. MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.cleanRequestByInteractionType called MsalPublicClientApplicationConfig.ts:37 msal: 2: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Info - Emitting event: msal:handleRedirectEnd MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Verbose - loginRedirect called MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Verbose - preflightBrowserEnvironmentCheck started MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Verbose - acquireTokenRedirect called MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Verbose - getAllAccounts called MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getIdTokenCredential: cache hit MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getAccessTokenCredential: cache hit MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getRefreshTokenCredential: cache hit MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getAccessTokenCredential: cache hit MsalPublicClientApplicationConfig.ts:37 msal: 2: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Info - Emitting event: msal:acquireTokenStart MsalPublicClientApplicationConfig.ts:37 msal: 3: [Thu, 25 Nov 2021 03:06:42 GMT] : [e64d39f1-8604-477f-a90d-b0ef2d7381f9] : msal.js.browser@2.18.0 : Verbose - preflightInteractiveRequest called, validating app environment MsalPublicClientApplicationConfig.ts:37 msal: 4: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Trace - BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies MsalPublicClientApplicationConfig.ts:37 msal: 2: [Thu, 25 Nov 2021 03:06:42 GMT] : @azure/msal-browser@2.18.0 : Info - Emitting event: msal:acquireTokenFailure AuthError.ts:45

   Uncaught (in promise) BrowserAuthError: interaction_in_progress: 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.
at BrowserAuthError.AuthError [as constructor] (AuthError.ts:45)
at new BrowserAuthError (BrowserAuthError.ts:159)
at Function.BrowserAuthError.createInteractionInProgressError (BrowserAuthError.ts:240)
at RedirectClient.StandardInteractionClient.preflightInteractiveRequest (StandardInteractionClient.ts:206)
at RedirectClient.<anonymous> (RedirectClient.ts:24)
at step (viewportRowModelModule.js:4)
at Object.next (viewportRowModelModule.js:4)
at viewportRowModelModule.js:4
at new Promise (<anonymous>)
at __awaiter (viewportRowModelModule.js:4)
at RedirectClient.acquireToken (RedirectClient.ts:23)
at PublicClientApplication.<anonymous> (ClientApplication.ts:205)
at step (viewportRowModelModule.js:4)
at Object.next (viewportRowModelModule.js:4)
at viewportRowModelModule.js:4
at new Promise (<anonymous>)
at __awaiter (viewportRowModelModule.js:4)
at PublicClientApplication.ClientApplication.acquireTokenRedirect (ClientApplication.ts:191)
at PublicClientApplication.<anonymous> (PublicClientApplication.ts:65)
at step (viewportRowModelModule.js:4)
at Object.next (viewportRowModelModule.js:4)
at viewportRowModelModule.js:4
at new Promise (<anonymous>)
at __awaiter (viewportRowModelModule.js:4)
at PublicClientApplication.loginRedirect (PublicClientApplication.ts:63)
at MsalAuthenticationProvider._callee5$ (MsalAuthenticationProvider.ts:108)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at asyncGeneratorStep (asyncToGenerator.js:3)
at _next (asyncToGenerator.js:25)
at asyncToGenerator.js:32
at new Promise (<anonymous>)
at MsalAuthenticationProvider.<anonymous> (asyncToGenerator.js:21)
at MsalAuthenticationProvider.login (MsalAuthenticationProvider.ts:24)
at _callee3$ (index.tsx:63)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at asyncGeneratorStep (asyncToGenerator.js:3)
at _next (asyncToGenerator.js:25)

MSAL Configuration

auth: {
        clientId: "f9818e52-50bd-463e-8932-a1650bd3fad2",
        authority: "https://login.microsoftonline.com/organizations", // organizations changes to [tenantId] in some scenarios.
    },
    cache: {
        cacheLocation: 'localStorage',
        storeAuthStateInCookie: true,
    },

Relevant Code Snippets

handleRedirectPromise is the first thing that happens when the app loads. 
handleRedirectPromise is awaited. 
loginRedirect is only called after handleRedirectPromise finishes.

Reproduction Steps

I am not sure what causes the cookie msal.interaction.status to be added, but if I manually add the cookie msal.interaction.status with the clientId as its value, loading the site again (Which calls handleRedirectPromise) doesn’t delete it.

Expected Behavior

msal.interaction.status should always be deleted when calling handleRedirectPromise (At least for the same clientId).

Identity Provider

Azure AD / MSA

Browsers Affected (Select all that apply)

Chrome, Edge

Regression

@azure/msal-browser@2.15.0

Source

Internal (Microsoft)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
samushenkovcommented, Dec 8, 2021

Yep, did it too.

1reaction
iziklcommented, Dec 8, 2021

@samushenkov until this bug is fixed, I workaround this bug by deleting the cookie msal.interaction.status immediately after the call to handleRedirectPromise.

document.cookie = 'msal.interaction.status=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT'
Read more comments on GitHub >

github_iconTop Results From Across the Web

BrowserAuthError: interaction_in_progress: Interaction is ...
The login data returns correctly but the exception is raised in the console. Uncaught (in promise) BrowserAuthError: interaction_in_progress:  ...
Read more >
interaction_in_progress: Interaction is currently in progress
I have tried to login from my Angular application with 3 types ... interaction_in_progress: Interaction is currently in progress.
Read more >
MSAL2.0 Errors and their Resolution | by Roma Rathi | Medium
1. Error : BrowserAuthError: interaction_in_progress: Interaction is currently in progress. Please ensure that this interaction has been ...
Read more >
Interaction is currently in progress with azure/msal-browser ...
During development, it is possible that you left the sign-in flow in a progress-state due to a coding issue that you will need...
Read more >
Solved: MSAL/Angular Browser error in chrome/firefox
Uncaught (in promise): BrowserAuthError: interaction_in_progress: Interaction is currently in progress. · Issue #3042 ...
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