Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do I get interaction_in_progress for the following order of method calls? #7502

Open
1 of 2 tasks
kudorgyozo opened this issue Jan 11, 2025 · 0 comments
Open
1 of 2 tasks
Labels
b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@kudorgyozo
Copy link

kudorgyozo commented Jan 11, 2025

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.28.0

Wrapper Library

Not Applicable

Wrapper Library Version

none

Public or Confidential Client?

Public

Description

I don't know if this is a bug or not. The following order of method calls are not working:

//refresh page
addEventCallback();
initialize();
getActiveAccount();
getAllAccounts();
loginRedirect();

and the following, with an extra clear cache does work:

//refresh
addEventCallback();
initialize();
getActiveAccount();
getAllAccounts();

clearCache(); <======== this
loginRedirect();

This is not the actual code, not even pseudocode, this is just an ordered list of things I do with the msal.js library.
Am I doing something wrong?

This is in an angular app, and I'm intentionally not using any wrapper. (I've had many issues with the angular wrapper, at least this is working, more or less) What I have is just a service that calls the msal instance, and a component with a login, logout button, that uses the instance.

Error Message

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 createBrowserAuthError (BrowserAuthError.mjs:272:10)
    at BrowserCacheManager.setInteractionInProgress (BrowserCacheManager.mjs:1049:15)
    at _StandardController.acquireTokenRedirect (StandardController.mjs:320:27)
    at _StandardController.loginRedirect (StandardController.mjs:1108:17)
    at _PublicClientApplication.loginRedirect (PublicClientApplication.mjs:230:28)
    at _AuthService.login (auth.service.ts:65:37)
    at _ProfileComponent.login (profile.component.ts:36:32)
    at ProfileComponent_Conditional_1_Template_button_click_0_listener (profile.component.html:3:56)
    at executeListenerWithErrorHandling (core.mjs:29245:12)
    at wrapListenerIn_markDirtyAndPreventDefault (core.mjs:29277:18)

MSAL Logs

Navigated to https://localhost:57429/profile
logging.service.ts:35 [LoggingService ctor] {logLevel: 0, consoleLogOnly: true}
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Trace - BrowserCacheManager - createKeyMaps called.
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Verbose - Event callback registered with id: 019456c8-8a39-73ae-8a69-08f04d6152fe
logging.service.ts:45 [DEBUG]: [Auth initInner start]
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Trace - initialize called
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 019456c8-8a39-73ae-8a69-08f04d6152fe: msal:initializeStart
logging.service.ts:45 [DEBUG]: [msal event, status]  {eventType: 'msal:initializeStart', interactionType: null, payload: null, error: null, timestamp: 1736622770748} null
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Verbose - Claims-based caching is disabled. Clearing the previous cache with claims
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Trace - Executing function clearTokensAndKeysWithClaims
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Trace - BrowserCacheManager.getTokenKeys called
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getTokenKeys - No token keys found
core.mjs:20876 Angular is running in development mode.
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Trace - Returning result from clearTokensAndKeysWithClaims
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 019456c8-8a39-73ae-8a69-08f04d6152fe: msal:initializeEnd
logging.service.ts:45 [DEBUG]: [msal event, status]  {eventType: 'msal:initializeEnd', interactionType: null, payload: null, error: null, timestamp: 1736622770755} null
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Trace - BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Trace - BrowserCacheManager.getActiveAccount: No active account found
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Verbose - getAllAccounts called
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Trace - BrowserCacheManager.getAccountKeys called
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:50 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getAccountKeys - No account keys found
logging.service.ts:45 [DEBUG]: [Auth initInner end]
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:55 GMT] : [019456c8-9b4b-73bd-875a-26e8bff8fa87] : @azure/[email protected] : Verbose - loginRedirect called
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:55 GMT] : [019456c8-9b4b-73bd-875a-26e8bff8fa87] : @azure/[email protected] : Verbose - acquireTokenRedirect called
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:55 GMT] : [] : @azure/[email protected] : Verbose - getAllAccounts called
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:55 GMT] : [] : @azure/[email protected] : Trace - BrowserCacheManager.getAccountKeys called
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:55 GMT] : [] : @azure/[email protected] : Verbose - BrowserCacheManager.getAccountKeys - No account keys found
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:55 GMT] : [] : @azure/[email protected] : Trace - BrowserCacheManager.getTemporaryCache: Temporary cache item returned
msal.config.ts:52 [Sat, 11 Jan 2025 19:12:55 GMT] : [] : @azure/[email protected] : Verbose - Emitting event to callback 019456c8-8a39-73ae-8a69-08f04d6152fe: msal:loginFailure
logging.service.ts:45 [DEBUG]: [msal event, status]  {eventType: 'msal:loginFailure', interactionType: 'redirect', payload: null, error: BrowserAuthError: interaction_in_progress: Interaction is currently in progress. Please ensure that…, timestamp: 1736622775116} none
logging.service.ts:72 [ERROR]: login error 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

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

auth: {
        clientId: environment.msalConfig.auth.clientId,
        authority: environment.b2cPolicies.authorities.signUpSignIn.authority,
        redirectUri: '/profile',
        postLogoutRedirectUri: '/home',
        knownAuthorities: [environment.b2cPolicies.authorityDomain]
    },
    cache: {
        cacheLocation: BrowserCacheLocation.LocalStorage
    },
    system: {
        allowNativeBroker: false, // Disables WAM Broker
        loggerOptions: {
            loggerCallback,
            logLevel: LogLevel.Trace,
            piiLoggingEnabled: true
        }
    }

Relevant Code Snippets

call these methods in this order
addEventCallback();
initialize();
getActiveAccount();
getAllAccounts();
loginRedirect();

Reproduction Steps

call these methods in this order, as mentioned above
addEventCallback();
initialize();
getActiveAccount();
getAllAccounts();
loginRedirect();

Expected Behavior

Login redirect should work

Identity Provider

Azure B2C Basic Policy

Browsers Affected (Select all that apply)

Chrome, Other

Regression

No response

@kudorgyozo kudorgyozo added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Jan 11, 2025
@github-actions github-actions bot added b2c Related to Azure B2C library-specific issues msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Jan 11, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

1 participant