Auth0 Home Blog Docs

Update: Log out doesn’t work and automatically signs in user

This is simply to add my experience to this thread which is now closed.

Log out doesn’t work and automatically sign in

Here is a quick checklist to ensure that your auth0 signout is working:

  1. Ensure that you have your domain url as an “allowed logout URL” in your auth0 application settings.
  2. Ensure that you format your logout request url like this:
    https://YOURTENANT.auth0.com/v2/logout?returnTo=YOURAUTHORIZEDLOGOUTURL&client_id=THECLIENTIDFORYOURAPPLICATION
  3. Finally the gotcha for me was: If you are using a custom domain for working with auth0.com, logout will not work using YOURTENANT.auth0.com. At least this was the fix for me that I couldn’t find anywhere else.

This means that if you are using mycooldomain.com as custom domain for auth0.com this will work:
https://mycooldomain.com/v2/logout?returnTo=YOURAUTHORIZEDLOGOUTURL&client_id=THECLIENTIDFORYOURAPPLICATION
but this will not:
https://YOURTENANT.auth0.com/v2/logout?returnTo=YOURAUTHORIZEDLOGOUTURL&client_id=THECLIENTIDFORYOURAPPLICATION

Took me a while (too long) to suss that one out.

1 Like

Thanks a lot @peterflat for sharing that knowledge with the rest of community!

Can’t mark first post as an answer so will paste it here. Here’s @peterflat knowledge which is a solution to this thread:

-------------------------> Solution <------------------------

This is simply to add my experience to this thread which is now closed.

Log out doesn’t work and automatically sign in

Here is a quick checklist to ensure that your auth0 signout is working:

  1. Ensure that you have your domain url as an “allowed logout URL” in your auth0 application settings.
  2. Ensure that you format your logout request url like this:
    https://YOURTENANT.auth0.com/v2/logout?returnTo=YOURAUTHORIZEDLOGOUTURL&client_id=THECLIENTIDFORYOURAPPLICATION
  3. Finally the gotcha for me was: If you are using a custom domain for working with auth0.com, logout will not work using YOURTENANT.auth0.com . At least this was the fix for me that I couldn’t find anywhere else.

This means that if you are using mycooldomain.com as custom domain for auth0.com this will work:
https://mycooldomain.com/v2/logout?returnTo=YOURAUTHORIZEDLOGOUTURL&client_id=THECLIENTIDFORYOURAPPLICATION
but this will not:
https://YOURTENANT.auth0.com/v2/logout?returnTo=YOURAUTHORIZEDLOGOUTURL&client_id=THECLIENTIDFORYOURAPPLICATION

Took me a while (too long) to suss that one out.