Bypassing "Pick user popup" after Sign out in a .Net 8 Blazor WASM application

Scot Woodyard 20 Reputation points
2024-02-21T16:05:34.4866667+00:00

How can I modify the logout code in my .Net 8 Blazor WASM application to include the logout_hint parameter? I have already enabled the login_hint optional claim in my client application and have the value of the logged-in user's login_hint optional claim. Here's the existing code:

@code{
    private async Task BeginLogout(MouseEventArgs args)
    {
        await SignOutManager.SetSignOutState();
        Navigation.NavigateTo("authentication/logout");
    }
}

Please advise on how I can bypass the "Pick user popup" after sign out.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,380 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,414 questions
0 comments No comments
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,361 Reputation points Microsoft Employee
    2024-02-21T19:30:30.37+00:00

    @Scot Woodyard

    Thank you for your post!

    To hopefully help point you in the right direction when it comes to modifying your Blazor application's code to include the login_hint parameter and bypass the "Pick user popup" after sign-out, you should be able to reference the below.

    For more info - How to Logout of an OAuth2 Application without getting prompted to seelct a user.

    // Construct the logout URL with the logout_hint and post_logout_redirect_uri parameters 
    
    var logoutUrl = $"https://login.microsoftonline.com/{tenant}/oauth2/logout?post_logout_redirect_uri={logoutRedirectUri}&logout_hint={userId}"; 
    
    var logoutUrl = $"authentication/logout?login_hint={userId}&post_logout_redirect_uri={logoutRedirectUri}&prompt=none";
    
    
    //Open ID Connect/OAuth2 application example:
    
    https://login.microsoftonline.com/{tenant}/oauth2/v2.0/logout?post_logout_redirect_uri={redirect_uri}&logout_hint={user_id}
    

    Additional Link:

    I hope this helps!

    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful