Logging out a User (XHR)


I’m working on an Angular JS application and while the login process is working, the logout process isn’t. I have a “logout” link that calls a function that runs something like so:

  url: 'https://mydomain.auth0.com/v2/logout',
  method: 'GET',
  params: {
    client_id: 'xxxxxxxxx',
    returnTo: 'https://mydomain.com/integrations/auth0/logout',
  headers: {
    'content-type': 'application/json',
    'x-requested-with': undefined,
    window.location.href = "https://mydomain.com/integrations/auth0/logout";
    window.location.href = "https://mydomain.com/integrations/auth0/logout";

When the logout request above is made, I get a 302 and end up in the “error” block. The redirect happens, and things seem fine, but when I check the history for the user I’m logged in as, I don’t see a “Success Logout” in the logs so it doesn’t seem like the logout is successful.

At one point I also tried an explicit request to /v2/logout on my back-end, but the logout API endpoint doesn’t allow passing any user metadata, so that’s not an option. I’m assuming that it needs to happen in the client so you can deal with the session stuff on your end.

Any thoughts here are welcome! Thanks!

When I look at the global logs, I do see successful logout requests using the code above, but it looks like there is no associated user_id or user_name data with them.