Login fails with interaction_in_progress error
See original GitHub issueCore 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:
Error Message
(with verbose logs enabled)
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
Source
Internal (Microsoft)
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (4 by maintainers)
Top GitHub Comments
Yep, did it too.
@samushenkov until this bug is fixed, I workaround this bug by deleting the cookie
msal.interaction.status
immediately after the call tohandleRedirectPromise
.