Skip to content

Interaction in progress error caused by other apps #7472

Open
@ruw321

Description

@ruw321

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.26.1

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

3.0.25

Public or Confidential Client?

Public

Description

In App A, I start the login process and then close the tap before it finishes. It will create a Msal.interaction.status cookie, and it will remain there even after I have closed App A. And when I try to login to App B, I get the interaction in progress error due to that cookie.

App A and App B share the same origin.

Is the cookie supposed to be there even after I have closed the tab?

I have also tried adding handleRedirectObservable() and handleRedirectPromise()

Error Message

Error - Guard - error: interaction_in_progress: Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API.

MSAL Logs

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Event callback registered with id: 0193d187-b9b4-7025-bb2d-10f56681ad78 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-b9b4-7025-bb2d-10f56681ad78: msal:initializeStart 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Claims-based caching is disabled. Clearing the previous cache with claims 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getTokenKeys - No token keys found 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - getAllAccounts called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getAccountKeys - No account keys found 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Event callback registered with id: 0193d187-ba1a-7184-add9-962819ae6299 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Guard - canActivate 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - MSAL Guard activated 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-b9b4-7025-bb2d-10f56681ad78: msal:initializeStart 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-ba1a-7184-add9-962819ae6299: msal:initializeStart 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Claims-based caching is disabled. Clearing the previous cache with claims 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getTokenKeys - No token keys found 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-b9b4-7025-bb2d-10f56681ad78: msal:initializeEnd 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-ba1a-7184-add9-962819ae6299: msal:initializeEnd 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-b9b4-7025-bb2d-10f56681ad78: msal:initializeEnd 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-ba1a-7184-add9-962819ae6299: msal:initializeEnd 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - handleRedirectPromise called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - getAllAccounts called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getAccountKeys - No account keys found 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-b9b4-7025-bb2d-10f56681ad78: msal:handleRedirectStart 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BroadcastService - msal:handleRedirectStart results in setting inProgress from startup to handleRedirect 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-ba1a-7184-add9-962819ae6299: msal:handleRedirectStart 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BroadcastService - msal:handleRedirectStart results in setting inProgress from startup to handleRedirect 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [0193d187-ba3b-7e38-a23a-de2d6c61cea0] : [email protected] : Verbose - initializeServerTelemetryManager called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [0193d187-ba3b-7e38-a23a-de2d6c61cea0] : [email protected] : Info - handleRedirectPromise called but there is no interaction in progress, returning null. 2

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - handleRedirectPromise has been called for the first time, storing the promise 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Info - initialize has already been called, exiting early. 2

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - handleRedirectPromise called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - handleRedirectPromise has been called previously, returning the result from the first call 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-b9b4-7025-bb2d-10f56681ad78: msal:handleRedirectEnd 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BroadcastService - msal:handleRedirectEnd results in setting inProgress from handleRedirect to none 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - getAllAccounts called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getAccountKeys - No account keys found 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - getAllAccounts called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getAccountKeys - No account keys found 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-ba1a-7184-add9-962819ae6299: msal:handleRedirectEnd 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BroadcastService - msal:handleRedirectEnd results in setting inProgress from handleRedirect to none 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - getAllAccounts called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getAccountKeys - No account keys found 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Guard - no accounts retrieved, log in required to activate 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Guard - logging in by redirect 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Guard - getting destination url 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [0193d187-ba41-706f-b183-3f8dd47ccb74] : @azure/[email protected] : Verbose - loginRedirect called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [0193d187-ba41-706f-b183-3f8dd47ccb74] : @azure/[email protected] : Verbose - acquireTokenRedirect called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - getAllAccounts called 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getAccountKeys - No account keys found 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-b9b4-7025-bb2d-10f56681ad78: msal:loginFailure 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 0193d187-ba1a-7184-add9-962819ae6299: msal:loginFailure 3

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Error - Guard - error while logging in, unable to activate 0

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Error - Guard - error: 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 0

app-config.ts:24 [Mon, 16 Dec 2024 22:12:33 GMT] : [] : @azure/[email protected] : Verbose - Guard - loginFailedRoute set, redirecting 3

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

export function MSALInstanceFactory(): IPublicClientApplication {

  return new PublicClientApplication({

    auth: {

      clientId: environment.msalConfig.auth.clientId,

      authority: environment.msalConfig.auth.authority,

      redirectUri: '/',

      postLogoutRedirectUri: '/',

    },

    cache: {

      cacheLocation: BrowserCacheLocation.LocalStorage,

    },

    system: {

      allowNativeBroker: false, // Disables WAM Broker

      loggerOptions: {

        loggerCallback,

        logLevel: LogLevel.Info,

        piiLoggingEnabled: false,

      },

    },

  });

}

Relevant Code Snippets

Export const routes: Routes = [
 {
   Path: Route.Home,
   Component: HomeComponent,
   CanActivate: [MsalGuard]
 } 
]

Reproduction Steps

  1. Have two applications with the same origin
  2. In Application A, start the login process and don’t complete it, then close the tab
  3. Go to application B, start the login process as well
  4. Then you will see the error

Expected Behavior

Cookie should be cleaned up after closing the tab, or on the login in attempt in the second application. MsalGuard should be able to redirect to login page instead of hitting the interaction in progress error.

Identity Provider

Azure B2C Custom Policy

Browsers Affected (Select all that apply)

Chrome, Other

Regression

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackAwaiting response from issue authorb2cRelated to Azure B2C library-specific issuesbug-unconfirmedA reported bug that needs to be investigated and confirmedmsal-angularRelated to @azure/msal-angular packagemsal-browserRelated to msal-browser packagepublic-clientIssues regarding PublicClientApplicationsquestionCustomer is asking for a clarification, use case or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions