Logout URL access denied - CORS error


I was reading the Auth0 docs regarding logging out a user. Currently, my Auth0 logout function logs out the user and redirects to a URL. Since I am building a single page application with Angular, I am trying to avoid redirecting by URL.

When calling the logout URL: https://my-domain.auth0.com/v2/logout, I get a CORS (‘Access-Control-Allow-Origin’) error saying the request has been blocked from origin http://localhost:4200. I have included the URLs in the Allowed Callback URLs and Allowed Origins (CORS). Though I still get the errors when calling the URL through JavaScript. Using Postman, I get the correct response but it does not logout the user from Auth0. However, if I go to the browser and type the logout URL: https://my-domain.auth0.com/v2/logout, I get the OK response and it correctly logs out the user from Auth0.

Is there a way to logout the user from Auth0 without redirecting?

Thank you.


I don’t think you need to call the endpoint yourself, you can see an example of logout here inside the AuthService.
In SPAs you just have to remove the data you see in the logout method and redirect as you want.

Hope it helps!

In case of the ‘Seamless SSO’ that you have introduced I think it is necessary to call the logout endpoint manually. I also have the problem with CORS error when I call it from inside of my application, while the logout works fine when I just paste the URL to the browser bar and run it. Hope you can update the guides because after you introducted the the feature almost behind the scenes the guides are outdated and just removing the storage does not log out the user from Auth0 session so one cannot for example log in to different account. Waiting for the answer.

1 Like

Without calling https://my-domain.auth0.com/v2/logout , next time system tries to login with current account, and it imposible to switch to another one.

Do you have any solution to this? I am still getting CORS issue with logout.

Hey! Did you find any solution to this problem? I still am facing the same issue.


Sorry for the long delay, lost the track of this thread :raised_back_of_hand:

My previous answer was wrong, you do have to redirect to logout the user properly (Log Users Out of Auth0), the way to do it using auth0.js is with this method: Auth0.js v9 Reference

It’s stated in those docs but I’ll highlight that you have to register an Allowed Logout URL in the dashboard either in your specific Application or globally in the tenant settings.

If you want to avoid the redirect you could try calling the logout endpoint in an iframe (inside your app) but bear in mind that this would be a workaround and is not supported in the SDK.

Let me know if this is helpful and sorry again for the delay!


1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.