Logout Redirection issue
See original GitHub issueCore Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
2.14.1
Wrapper Library
MSAL Angular (@azure/msal-angular)
Wrapper Library Version
2.0.0-beta.5
Description
There is a mismatch about what the documentation says about the post logout redirection and what actually happens. I will try to elaborate. The documentation can be found here.
postLogoutRedirectUri is required in order for MSAL to be able to close the popup when signout is complete
If I don’t set the postLogoutRedirectUri, the popup still closes.
postLogoutRedirectUri will be opened in the popup window, not the main frame. If you need your top level app to be redirected after logout you can use the mainWindowRedirectUri parameter on the logout request.
If I set the postLogoutRedirectUri
, I am not sure if the URI is opened in the popup window, but what I am experiencing is that it is opening in the main frame for sure. I can not find a difference between the postLogoutRedirectUri
and the mainWindowRedirectUri
inside of the logout request.
Error Message
No response
Msal Logs
No response
MSAL Configuration
{
auth: {
clientId: environment.AzureClientId,
authority: b2cPolicies.authorities.signUpSignIn.authority,
redirectUri: environment.FrontendBaseUrl,
postLogoutRedirectUri: environment.FrontendBaseUrl,
knownAuthorities: [environment.AzureB2CKnownAuthority],
},
cache: {
cacheLocation: BrowserCacheLocation.LocalStorage,
storeAuthStateInCookie: isIE, // set to true for IE 11
},
}
Relevant Code Snippets
if (this.msalGuardConfig.interactionType === InteractionType.Popup) {
return this.msal.logoutPopup({
mainWindowRedirectUri: "/logout"
});
} else {
return this.msal.logoutRedirect();
}
if (this.msalGuardConfig.interactionType === InteractionType.Popup) {
return this.msal.logoutPopup({
postLogoutRedirectUri: "/logout"
});
} else {
return this.msal.logoutRedirect();
}
Both main frmes land in the /logout
page.
Reproduction Steps
- Logout
Expected Behavior
I am not sure what the correct behavior should be, but either the docs or the behavior should be updated to match each other.
Identity Provider
Azure B2C Basic Policy
Browsers Affected (Select all that apply)
Edge
Regression
No response
Source
External (Customer)
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@eluchsinger This was in reference to your first question about why the popup still closes despite not including
postLogoutRedirectUri
on the request object.postLogoutRedirectUri
-> navigated to in the popup windowmainWindowRedirectUri
-> navigated to in the main windowCan you please provide logs and/or a link to a minimal reproduction? The main window should not be redirecting at all if
mainWindowRedirectUri
is not set on the request.@eluchsinger 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.