interaction_in_progress: Interaction is currently in progress.
See original GitHub issueI’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:
- Created 3 years ago
- Comments:9 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
@tnorling I’m still able to reproduce this using
loginRedirect
withmsal-browser@2.11.0
.