Logout always causes CORS error

Ready to post? :mag: First, try searching for your answer.
I can successfully authenticate with Auth0 using my Next.js application but whenever I try to logout I always get a CORS error:

Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

It does not work from localhost but it does work from our development domain


Hi @prodz

Welcome to the Auth0 Community!

Thank you for posting your question. If you are using the Link component from the Next.js it can cause the prefetch. Can you confirm if you are using The Link component and change it to the native <a> tag?

Thanks
Dawid

1 Like

That fixed it!

{  item.name === 'Logout' ? (
    <a href={item.routePath}>
      <i className={`la ${item.icon}`}></i> {item.name}
    </a>
    ) : (
    <Link href={item.routePath}>
      <i className={`la ${item.icon}`}></i> {item.name}
    </Link>
)}
1 Like

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