# Logout always causes CORS error

**URL:** <https://community.auth0.com/t/logout-always-causes-cors-error/140859>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [August 12, 2024, 1:31am UTC](https://community.auth0.com/t/logout-always-causes-cors-error/140859 "2024-08-12T01:31:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prodz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prodz/32/50398_2.png) [@prodz](https://community.auth0.com/u/prodz)\
**Post date:** [August 12, 2024, 1:31am UTC](https://community.auth0.com/t/logout-always-causes-cors-error/140859/1 "2024-08-12T01:31:09Z")

</div>

Ready to post? 🔍 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

 ![Screenshot 2024-08-11 at 9.24.07 PM](https://global.discourse-cdn.com/auth0/original/3X/3/e/3ee3748ea545ad7b59654089ebeee02baed9d0f0.png)  
 ![Screenshot 2024-08-11 at 9.21.55 PM](https://global.discourse-cdn.com/auth0/original/3X/7/7/77f1a51bd23586ad397622faf4a817e992308d2b.png)

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [August 12, 2024, 7:15pm UTC](https://community.auth0.com/t/logout-always-causes-cors-error/140859/2 "2024-08-12T19:15:54Z")

</div>

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?

[https://community.auth0.com/t/next-js-sdk-logout-does-not-work-due-to-cors-error/139035](https://community.auth0.com/t/next-js-sdk-logout-does-not-work-due-to-cors-error/139035)

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![prodz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prodz/32/50398_2.png) [@prodz](https://community.auth0.com/u/prodz)\
**Post date:** [August 12, 2024, 8:33pm UTC](https://community.auth0.com/t/logout-always-causes-cors-error/140859/3 "2024-08-12T20:33:17Z")

</div>

That fixed it!

```auto
{ 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>
)}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 26, 2024, 8:33pm UTC](https://community.auth0.com/t/logout-always-causes-cors-error/140859/4 "2024-08-26T20:33:44Z")

</div>

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