After trying to log in, login pop-up not closing and inside that pop-up window application is rendering
See original GitHub issueCore Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
2.32.0
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
1.4.6
Public or Confidential Client?
Public
Description
The issue is intermittent. In login pop-up window the user typed valid credentials to log in his Microsoft account. In most cases the user will successfully be logged in and pop-up will close.
However, sometimes login pop-up doesn’t close and inside that pop-up window the user can use the same application. I noticed that app is also running in the parent app window but user is not logged in.
I have noticed that logging out from your MS account in the browser, makes the popup require the email again and it works. IF there isn’t a fix for this, is there a way I can always ask for the credentials even though I am signed in in the browser?
When this happens, the URL contains a hash #code=0.AXQABc3mS.
Error Message
No response
Msal Logs
No response
MSAL Configuration
export const msalConfig: Configuration = {
auth: {
clientId: process.env.REACT_APP_AZURE_CLIENT_ID,
redirectUri: process.env.REACT_APP_AZURE_REDIRECT_URI,
postLogoutRedirectUri: process.env.REACT_APP_AZURE_POSTLOGOUT_REDIRECT_URI,
},
cache: {
cacheLocation: "localStorage",
storeAuthStateInCookie: isIE || isEdge || isFirefox,
},
system: {
asyncPopups: true,
allowRedirectInIframe: true, // Needed for Front-channel logout
loggerOptions: {
loggerCallback: (level, message, containsPii) => {
if (containsPii) {
return;
}
switch (level) {
case LogLevel.Error:
console.error(message);
return;
case LogLevel.Info:
console.info(message);
return;
case LogLevel.Verbose:
console.debug(message);
return;
case LogLevel.Warning:
console.warn(message);
return;
default:
return;
}
},
},
},
};
Relevant Code Snippets
<MsalAuthenticationTemplate
interactionType={InteractionType.Popup}
authenticationRequest={authRequest}
errorComponent={ErrorComponent}
loadingComponent={LoadingComponent}
/>
Reproduction Steps
User clicks to log into application with his Microsoft account. Pop-up window shows up and user enters valid credentials to sign in with his MS account. The pop-up does not close and inside that pop-up window application is rendering.
Expected Behavior
After giving valid credentials the login pop-up window is always closing and user is logged into application.
Identity Provider
Azure AD / MSA
Browsers Affected (Select all that apply)
Chrome, Firefox
Regression
No response
Source
Internal (Microsoft)
Issue Analytics
- State:
- Created 9 months ago
- Comments:13 (2 by maintainers)
Because this is a race condition. When it fails it means whatever is removing the hash won the race. When it succeeds it means MSAL.js won the race. By ensuring that your router is not acting upon the redirectUri page you eliminate the race and ensure that MSAL.js always has access to the hash.
@diamant-isufi-sveasolar This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.