I have a Blazor 8.0 Server application that uses Azure B2C for authentication and authorization. The signin process works correctly. But, the sign-out process does not clear the user identity in the authentication state. I am using the logout link from B2C configuration endpoints along with the NavigationManager to send the user the specified endpoint. B2C appears to process the logout and sends the user back to the url specified in the post_redirect_url parameter, but the state still has the authenticated user.
string logofflink = $"https://<TenentId>.b2clogin.com/<TenantId>.onmicrosoft.com/oauth2/v2.0/logout?p=B2C_1_bd_si&id_token_hint={appState.IdToken}&post_logout_redirect_uri={navigationManager.BaseUri}signout";
Microsoft.AspNetCore.Components.WebAssembly.Authentication.NavigationManagerExtensions.NavigateToLogout(navigationManager, logofflink);
I ave tried several different solutions:
- Using the SSO logout methods. That generated a MS error
- Signout using the HttpContext, does not clear the Auth State
- Implementing a RevalidatingAuthenticationStateProvider. that gave me an error registering the SignInManager.