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);
Developer technologies | ASP.NET | ASP.NET Core
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 30,296 Reputation points Microsoft Employee Moderator
    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.