Can anyone confirm if the Sitecore.Security.Authentication.AuthenticationManager.Logout(); handles the logout from AdB2c IDP as well, as per documentation from at:


Sitecore automatically handles this. But I don't see the cookies getting cleared.

Code from processor in which PostLogoutRedirectUri is set-

private OpenIdConnectAuthenticationOptions CreateOptionsFromPolicy(string policy)
            var identityProvider = GetIdentityProvider();
            return new OpenIdConnectAuthenticationOptions
                // For each policy, give OWIN the policy-specific metadata address, and
                // set the authentication type to the id of the policy
                MetadataAddress = String.Format(WellKnownMetadata, Tenant, policy),
                //AuthenticationType = GetAuthenticationType(),
                AuthenticationType = policy,
                AuthenticationMode = AuthenticationMode.Passive,
                RequireHttpsMetadata = RequireHttps,

                // These are standard OpenID Connect parameters, with values pulled from settings
                ClientId = ClientId,
                // Scope = "openid profile offline_access",
                Scope = $"openid profile offline_access { _defaultScope }",
                //ResponseType = "id_token",
                RedirectUri = RedirectUri, //SK RedirectIframeUri
                PostLogoutRedirectUri = RedirectUri,                

                Notifications = new OpenIdConnectAuthenticationNotifications
                    RedirectToIdentityProvider = OnRedirectToIdentityProvider,                    
                    AuthenticationFailed = OnAuthenticationFailed,
                    SecurityTokenValidated = OnSecurityTokenValidated,                   
                    AuthorizationCodeReceived = OnAuthorizationCodeReceived,
                // This piece is optional - it is used for displaying the user's name in the navigation bar.
                TokenValidationParameters = new TokenValidationParameters
                    NameClaimType = "name",                    
                    ValidateIssuer = false,
                    SaveSigninToken = identityProvider.TriggerExternalSignOut

IdentityProcider config

<identityProvider id="AzureAdB2C" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication">
          <param desc="name">$(id)</param>
          <param desc="domainManager" type="Sitecore.Abstractions.BaseDomainManager" resolve="true" />
          <transformations hint="list:AddTransformation">
            <transformation name="Name Identifier Claim" type="Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication">
              <sources hint="raw:AddSource">
                <claim name="http://schemas.microsoft.com/identity/claims/objectidentifier" />
              <targets hint="raw:AddTarget">
                <claim name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" />

Probably might help someone. I managed to figure this out as the issue was on the Controller Action for SignOut.

Sitecore handles the Owin Middleware integration little differently from Asp.NET. Below is the code for my Signout Action. Here please note, we need to pass the IDP Name "AzureADB2C" explicitly for Sitecore to know which provider is being logged out. After this , Sitecore will send a request to AdB2C post logout redirect Uri

// To sign out the user, you should issue an OpenIDConnect sign out request.
            if (Sitecore.Context.User.IsAuthenticated)
                HttpContext.GetOwinContext().Authentication.SignOut(new AuthenticationProperties { }, new string[] { "AzureAdB2C", Startup.SignInPolicyId });


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.