How to bypass account selection when application logs out in azure app service using asp.net core

Jagmohan Singh Salaria 0 Reputation points
2024-07-16T11:32:47.5833333+00:00

We have implemented the application logging out feature when user idle time gets over. However, on logging out we are getting account selection popup window which we want bypass and application logs out itself completely. We are using angular and asp.net core .

sample signout code in controller

return SignOut(new AuthenticationProperties {

     RedirectUri = "sampleLog"

 },

 CookieAuthenticationDefaults.AuthenticationScheme,

 OpenIdConnectDefaults.AuthenticationScheme);
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,400 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,621 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 29,681 Reputation points Microsoft Employee
    2024-07-22T10:49:55.3+00:00

    Hi Jagmohan Singh Salaria,

    Thanks for reaching out.

    It seems like you are using ASP.NET Core and OpenID Connect for authentication. The account selection popup window appears when there are multiple accounts signed in.

    To bypass this window and log out completely, you can add the prompt=none parameter to the logout request. This parameter tells the identity provider to not display any user interaction, and to fail the request if the user is not already authenticated.

    Here's an example of how you can modify your signout code to include the prompt=none parameter:

    return SignOut(new AuthenticationProperties 
    { RedirectUri = "sampleLog",
     Parameters =
     {
     { "prompt", "none" } 
    }
     }, 
    CookieAuthenticationDefaults.AuthenticationScheme, OpenIdConnectDefaults.AuthenticationScheme);
    

    This should log out the user completely without displaying the account selection popup window.

    Thanks,

    Shweta

    Please remember to "Accept Answer" if answer helped you.

    0 comments No comments