Auth0 Home Blog Docs

Logout from Lock w/o redirect?

lock
#1

I am using the lock widget (v11) for user login:

  lockAuth(e) {
    this.lock.show()
  }

For logout I am using the following code:

  lockLogout() {
    this.lock.logout(
      {
        returnTo: window.location.href
      }
    )
  }

This leads to a reload of my application after each logout.

I would like to avoid the redirect after login and rather not reload my SPA after logout. Is this possible?

#2

If you remove the returnTo parameter, Auth0 will just show an “OK” message instead of redirecting to the returnTo URL. Or you can also provide a different URL pointing to a lightweight page served from your app domain that simply shows a logout message.