Skip to main content Skip to docs navigation

Log Out User - myMLA SSO

Learn how to log out users the myMLA SSO platform, as well as locally.

On each page, if the user is authenticated, you should display a link similar the one shown below.

            
    <a asp-controller="Account" asp-action="Logout">Logout</a>
            
        

This should have the corresponding end point shown below. You need to provide a redirect url as part of the authentication properties. This url must be registered in the myMLA SSO dashboard.

This will sign the user out from the myMLA SSO platform as well as signing out the user locally.

            
    public class AccountController 
        : Controller
    {

        [Authorize]
        public async Task Logout()
        {
            var authenticationProperties = new LogoutAuthenticationPropertiesBuilder()
                .WithRedirectUri("/")
                .Build();

            await HttpContext.SignOutAsync(Auth0Constants.AuthenticationScheme, 
                                           authenticationProperties);

            await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
        }
    }