We have setup Auth0 as an external identity provider successfully where login works just fine for our public website. The sitecore authoring server uses the default Sitecore Identity Server.
For the logout we are trying to call AuthenticationManager.Logout()
method from an API endpoint /sitecore/api/logout/v1
using fetch that has follow redirects configured (and tested with other endpoints).
The method should be invoking the OWIN middleware which should set the response to redirect to the Auth0 provider and subsequently redirect to back to the postexternallogout
endpoint. However, the middleware is never executed and the redirect never occurs and instead the endpoint returns 200 status. Reloading the page however, the first thing that happens is the OWIN middleware does execute with the logout notification which triggers the flow including the redirects.
Furthermore, if we call the HttpContext.Current.GetOwinContext().SignOut("Auth0")
from the same endpoint, everything works just as expected with the OWIN middleware and the redirects work just fine. However, the ASP.Net session is not cleared!
So what is happening inside the AuthenticationManager.Logout
which is causing this behaviour of not completing the request until another request comes in? If there is something misconfigured with our sitecore instance, where could we look to find out?
HttpContext.GetOwinContext().Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);HttpContext.GetOwinContext().Authentication.SignOut("Auth0");