Getting error: 'No 'Access-Control-Allow-Origin' header is present on the requested resource.' for logout route in Django/React app

I have an app using React/Django, with Auth0 for authentication. I've followed this tutorial to fix any CORS errors, and all my routes are not running into any issues, except for my logout route.

I'm creating a logout button, which will flush the user's session on Django and redirect to the Auth0 logout page as well.

urlpatterns = [
   path('logout/, views.logout, name = 'logout')

from django.contrib.auth import logout as django_logout
def logout(request):
   domain = settings.AUTH0_DOMAIN
   client_id = settings.AUTH0_CLIENT_ID
   return_to = ''
   return redirect(f'https://{domain}/v2/logout?client_id={client_id}&returnTo={returnTo}')


const App = () => {
   const logout = async () => {
      await fetch('')
   return (
         <button onClick={logout}>Logout</button>

When the user logs out, I'm getting a CORS error despite importing and configuring django-cors-headers and not getting this error for any other route. Specifically, the error is No 'Access-Control-Allow-Origin' header is present on the requested resource.

Back to Top