Auth0 Home Blog Docs

Correct way to return to hosted login (soft logout)



My SPA app requires users are always authenticated. I have a logout button in the app that I want to return users to the hosted login page.

I thought the correct way would be simply to call auth0.authorize() again. This does return to the hosted login page, but there is an issue that when you click to login again, you get sent back to the hosted login. If you click again, it works. So, you always have to login twice after being sent back to the hosted login via auth0.authorize().

I am using the javascript SDK login sample code, just added auth0.authorize at the end of the logout function.


I resolved this. Was an issue with my isAuthenticated check. I was running the isAuthenticated check on the callback page which was then calling auth0.authorise() again. Whitelisted the callback page from the auth check.