Logout redirecting 3 or more times
See original GitHub issueCore Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
2.21.0
Wrapper Library
MSAL Angular (@azure/msal-angular)
Wrapper Library Version
2.1.0
Description
When I call the msalService.logoutRedirect({ postLogoutRedirectUrl: …appurl }) the msal library goes between the Azure B2C logout route and my app 3 or more times before finally routing to the login screen. I know this redirect needs to happen at least once based on B2C’s current functionality. I verified that when I call the logout function that localStorage is getting cleared out with all the Azure B2C token information. Also I’m using the MSAL redirect component, and I have it in my index.html file.
Error Message
No response
Msal Logs
No response
MSAL Configuration
{
auth: {
clientId: environment.clientIdMS, // This is your client ID
authority: environment.authorityMS, // This is your tenant ID
knownAuthorities: [B2C Tenant],
redirectUri: environment.redirectUriMS // This is your redirect URI
},
cache: {
cacheLocation: 'localStorage',
storeAuthStateInCookie: isIE, // Set to true for Internet Explorer 11
},
system: {
loggerOptions: {
loggerCallback,
logLevel: LogLevel.Info,
piiLoggingEnabled: false
}
}
}
Relevant Code Snippets
// Guard config
{
interactionType: InteractionType.Redirect,
authRequest: {
scopes: ['openid', 'profile',
API Scope],
extraQueryParameters: {
test: 'test'
}
}
}
// Listener to check if user is logged in
this.msalBroadcast.inProgress$
.pipe(
filter((status: InteractionStatus) => status === InteractionStatus.None),
takeUntil(this._destroying$)
)
.subscribe((result) => {
// const payload = result.payload as AuthenticationResult;
this.loggedIn = this.msalService.instance.getAllAccounts().length > 0;
if (this.loggedIn)
this.checkAccount();
});
// Logout function
this.msalService.logoutRedirect({
postLogoutRedirectUri: environment.redirectUriMS,
account: this.msalService.instance.getActiveAccount() // I've tried it with and without this line
});
Reproduction Steps
- Call the logoutRedirect call
Expected Behavior
To be redirected once and then back to the login page
Identity Provider
Azure B2C Custom Policy
Browsers Affected (Select all that apply)
Chrome, Firefox, Edge, Safari, Internet Explorer
Regression
No response
Source
External (Customer)
Issue Analytics
- State:
- Created 2 years ago
- Comments:23 (10 by maintainers)
Top GitHub Comments
Thanks @DerekJDev I got it, reviewing today and will get as soon as I can!
This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @pkanher617 please follow up.