Auth0 Home Blog Docs

webAuth.logout({clientId: ..., redirectTo: ...}) goes to login page instead of redirectTo URL

I’m logging out with:

      webAuth.logout({
        clientId: webAuth.baseOptions.clientID,
        returnTo: window.location.origin,
      })

I verified that Auth0.js is passing my returnTo URL in dev tools:

You can see returnTo=http%3A%2F%2Flocalhost%3A4000 in the console.
I’ve added this URL (http://localhost:4000) to my allowed logout URLs in my dev app in Auth0.

Yet Auth0 never redirects to it after logging out, it just stays on the login page. When I log back in, it uses the same redirectUri from the last call to webAuth.authorize, which is causing problems (it contains my own ?nextLocation=... parameter for redirecting after login, but that parameter is no longer valid).

Am I doing something wrong or is this a bug? I thought Auth0.js would log the user out and then return to http://localhost:4000 because that’s what I passed for returnTo.

I’m using auth0-js version 9.10.0.

Hey there!

Sorry for such huge delay in response! We’re doing our best in providing you with best developer support experience out there, but sometimes our bandwidth is not enough comparing to the number of incoming questions.

Wanted to reach out to know if you still require further assistance?