0

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?

3
  • We are using a really bad hack at the moment, where we are calling logout endpoint once, and then calling another API endpoint that returns nothing but an OK that will trigger the OWIN pipeline. :facepalm: Commented Jul 12, 2022 at 4:50
  • Did you also try the logout as recommended here: auth0.com/docs/quickstart/webapp/aspnet-owin/… HttpContext.GetOwinContext().Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);HttpContext.GetOwinContext().Authentication.SignOut("Auth0");
    – Jeroen
    Commented Jul 13, 2022 at 14:24
  • Yes, that's already stated above: "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!" Commented Jul 13, 2022 at 23:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.