Auth0 Home Blog Docs

JavaScript SDK Calling webAuth.logout does not work



Hi there!

SDK: auth0-js
Version: 9.7.3
Platform: in-browser, latest Chrome
I’m just getting started, the code had not previously worked for me

Here is the HAR file:
localhost.har (21.4 KB)

Having trouble calling the logout endpoint. In some cases, when I call webAuth.logout, it does not log out, but instead redirects to my login callback URL. My app then logs the user back in (i.e. writes token to local storage), which results in a continuous cycle of not being able to logout at all. In other cases, it works as expected. I noticed that it brakes when authentication method is set to Database, and works as expected when it is Google Oauth.

I did not see an obvious difference between requests made when it works and when it doesn’t, but I noticed that in both cases it ignores returnTo parameter that I pass to webAuth.logout.

Here is my client side code:

export default class Auth {
static domain = ;
static clientId = ;

constructor() {
this.login = this.login.bind(this);
this.logout = this.logout.bind(this);
this.handleAuthentication = this.handleAuthentication.bind(this);

auth0 = new auth0.WebAuth({
domain: Auth.domain,
clientID: Auth.clientId,
responseType: ‘id_token’,
scope: ‘openid profile email’

handleAuthentication(callback) {
this.auth0.parseHash((err, authResult) => {
if (authResult && authResult.idToken) {

  } else if (err) {
    throw new Error(err);


login() {
redirectUri: http://localhost:3001${AUTH_LOGIN_CALLBACK_ROUTE}

signup() {
redirectUri: http://localhost:3001${AUTH_SIGNUP_CALLBACK_ROUTE}

logout() {

  returnTo: 'http://localhost:3000/',
  clientId: Auth.clientId,


Thanks for your help!


Hello did you manage solve your issue? I am having the same problem. The logout function in my webapp was just working a few days ago. We did not change anything and now It just stopped working.


I’m also having exactly the same issue with this code:

public logout() {
    returnTo: 'http://my-return-url',
    client_id: 'my-client-id'


I noticed that you are using clientId and I have been using client_id, but it doesn’t seem to make a difference. TypeScript typings have clientID in the LogoutOptions, but it doesn’t work either:

export interface LogoutOptions {
  clientID?: string;
  returnTo?: string;
  federated?: boolean;