Login popup doesn't close and displays react app itself
See original GitHub issueCore Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
2.28.1
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
1.4.5
Description
Hi, I think I’ve just found a bug in MSAL.js. I installed the latest version in two different samples for React. When I try to log in, sometimes the popup shows the React Webapp itself and doesn’t close.
- The first sample I used was this one: https://github.com/Azure-Samples/ms-identity-javascript-react-spa
- And the second one was here in this repository: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/react-18-sample
Error Message
No response
Msal Logs
No response
MSAL Configuration
{
auth: {
clientId: "my_client_id",
authority: "https://login.microsoftonline.com/...",
redirectUri: "http://localhost:3000"
},
cache: {
cacheLocation: "sessionStorage",
storeAuthStateInCookie: false
},
system: {
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;
}
}
}
}
}
Relevant Code Snippets
There is no relevant code snippet as I have only changed the MSAL configuration.
Reproduction Steps
- Clone the sample
- Install the newest version of @azure/msal-browser and @azure/msal-react through npm.
- Adjust MSAL configuration
- Run the sample and try to log in several times.
Expected Behavior
Login popup should close, but it doesn’t.
Identity Provider
Azure AD / MSA
Browsers Affected (Select all that apply)
Chrome, Firefox, Edge
Regression
@azure/msal-browser 2.15.0
Source
External (Customer)
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:30 (9 by maintainers)
Top Results From Across the Web
Microsoft Authentication Library (MSAL) loginPopup doesn't ...
Expected behavior: A login popup pops up and after the user logs in the pop up closes itself and the loginPopup promise resolves...
Read more >Creating A PopUp Window Using JS And React - Medium
A small guide on creating the infamous “popup” window that is both a blessing and a curse for users with the help of...
Read more >Error Boundaries - React
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI ......
Read more >React | IntelliJ IDEA Documentation - JetBrains
Open the application sources that are already on your machine. Click Open or Import on the Welcome screen or select File | ...
Read more >How to Open and Close a React-Bootstrap Modal ... - Pluralsight
# Introduction · Import Components from React Bootstrap · Set up the Modal Component · Build the Login Form · Handle the onSubmit()...
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
I think this issue is not resolved yet, even with the blank route. As @hectormmg said, it just mitigate the race condition (?)
No this is a race condition between the popup window and the caller. The problem only surfaces when the router (or other hash clearing/redirection logic) wins the race. Check if there’s a hash with
code=
in the address bar of the popup window when this occurs. If there’s not, something inside the popup is removing the hash.