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.

interaction_in_progress: Interaction is currently in progress.

See original GitHub issue

I’m attempting to use the loginRedirect. When calling the function I receive the following error:

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

Code Path:

export const App = () => 
{
  const [auth] = useState(new AuthStore());

  useEffect(() => {initializeIcons();}, [])

  try
  {
    auth.msalClient.loginRedirect();
  }
  catch(err)
  {
    console.log(err)
  }
  ....
  }

AuthStore is a simple class wrapper around the msalClient and configuration objects, as well as the register call for the redirect callback.

AuthStore.tsx

import * as msal from "@azure/msal-browser";

export class AuthStore
{
    accountId?: string;
    idToken?: string;
    msalClient: msal.PublicClientApplication = new msal.PublicClientApplication(
        {
            auth: 
            {
                clientId: '...',
                authority: 'https://login.microsoftonline.com/...'
            }
        }
    );

    constructor() 
    {
        // Register Callbacks for Redirect flow
        this.msalClient.handleRedirectPromise()
            .then(this.handleResponse)
            .catch((error) => 
            {
                // TODO: Logging!
                console.log("Handle Redir: " + error);
            }
        );
    }

    handleResponse(resp: msal.AuthenticationResult | null) 
    {
        if (resp !== null && resp.account !== null)
        {
            this.accountId = resp.account.homeAccountId;
            this.idToken = resp.idToken;
        }
        else
        {
            const currentAccounts = this.msalClient.getAllAccounts();

            if (!currentAccounts || currentAccounts.length < 1) 
            {
                this.msalClient.loginRedirect({scopes: ["User.Read"]});
            }
        }
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
tnorlingcommented, Jan 25, 2021

@AGDevX Thanks for the information. I’ve identified the source of the regression and will make sure a fix is included in the next release.

2reactions
fjuriollicommented, Feb 2, 2021

@tnorling I’m still able to reproduce this using loginRedirect with msal-browser@2.11.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BrowserAuthError: interaction_in_progress: Interaction is ...
I has this error when trying to loginRedirect in React app using @azure/msal-react@1.0.0-alpha.6 and @azure/msal-browser@2.11.2. The login data ...
Read more >
BrowserAuthError: interaction_in_progress - Unable to fix, ...
BrowserAuthError : interaction_in_progress: Interaction is currently in progress. Please ensure that this interaction has been completed before ...
Read more >
interaction_in_progress" in SPA with MSAL redirect and ...
I have a react SPA that uses MSAL and Azure AD B2C for authentication. In every page, the user is able to sign...
Read more >
MSAL2.0 Errors and their Resolution | by Roma Rathi
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 ...
[Solved]-BrowserAuthError: interaction_in_progress: Interaction is currently in progress with azure/msal-browser@2.11.2-Reactjs · Looks into session storage for ...
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