# CORS issues with /authorize

**URL:** <https://community.auth0.com/t/cors-issues-with-authorize/90667>\
**Category:** Get Help\
**Tags:** localhost, cors, express\
**Created:** [September 15, 2022, 9:00am UTC](https://community.auth0.com/t/cors-issues-with-authorize/90667 "2022-09-15T09:00:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yaacov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yaacov/32/33349_2.png) [@yaacov](https://community.auth0.com/u/yaacov)\
**Post date:** [September 15, 2022, 9:00am UTC](https://community.auth0.com/t/cors-issues-with-authorize/90667/1 "2022-09-15T09:00:23Z")

</div>

Hi,  
I am attempting to set up an auth0 integration with node.js backend and next.js frontend. The node backend uses the express-openid-connect library.

When encountering a logged-out user, the node server redirects the frontend to /authorize’, which is rejected due to CORS policy.

 ![Screen Shot 2022-09-15 at 2.20.50 PM](https://global.discourse-cdn.com/auth0/original/3X/e/5/e50525cafa72c51f34b77c9f72c7a0ff3efde216.png)

Things I have tried:

- [CORS issue using /authorize endpoint](https://community.auth0.com/t/cors-issue-using-authorize-endpoint/6901)  
Used localho.st:3000 instead of localhost:3000 to get around the issue, still fails

- [CORS error when calling /authorization from React app](https://community.auth0.com/t/cors-error-when-calling-authorization-from-react-app/83309)  
I have confirmed that the state parameter is present. The URL works when you load it in the browser, it only fails due to CORS.

- [CORS issues on localhost](https://community.auth0.com/t/cors-issues-on-localhost/63137)  
I am not using XMLHttpRequest, but redirecting instead

## CORS config:

 ![Screen Shot 2022-09-16 at 9.26.56 AM](https://global.discourse-cdn.com/auth0/original/3X/1/1/11eafd40805d0e5158519e6dd5d0c8d107500106.jpeg)

I am using Universal Login, and I do not have a custom domain present in my tenant. This is a development environment only.

It seems like users have been having this problem for many years and it hasn’t been fixed [API being blocked by CORS even though it's an allowed origin](https://community.auth0.com/t/api-being-blocked-by-cors-even-though-its-an-allowed-origin/31205)

---

<div class="post-metadata">

**Author:** ![yaacov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yaacov/32/33349_2.png) [@yaacov](https://community.auth0.com/u/yaacov)\
**Post date:** [October 31, 2022, 10:39am UTC](https://community.auth0.com/t/cors-issues-with-authorize/90667/2 "2022-10-31T10:39:47Z")

</div>

Update: Due to lack of support on this issue I have migrated away from auth0. I encourage other users to do the same.

---

<div class="post-metadata">

**Author:** ![vaclav.stummer](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vaclav.stummer/32/33629_2.png) [@vaclav.stummer](https://community.auth0.com/u/vaclav.stummer)\
**Post date:** [August 1, 2023, 9:38am UTC](https://community.auth0.com/t/cors-issues-with-authorize/90667/3 "2023-08-01T09:38:36Z")

</div>

@yaacov I feel your pain. They just don’t give a sh\*t, since Okta acquired them

---

<div class="post-metadata">

**Author:** ![kybak](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kybak/32/50002_2.png) [@kybak](https://community.auth0.com/u/kybak)\
**Post date:** [September 6, 2023, 11:18pm UTC](https://community.auth0.com/t/cors-issues-with-authorize/90667/4 "2023-09-06T23:18:55Z")

</div>

Apologies for rehashing this but I feel like there should be a resolution here in case anyone else finds this, like me.

All modern browsers enforce the Same-Origin Policy (SOP), which means a web page served from one origin cannot freely make requests to a different origin unless the other origin allows it with Cross-Origin Resource Sharing (CORS) headers.

The solution is to delegate the call to your server. In my case in node.js express it was a simple matter of returning res.redirect(“https://{domain}/authorize?..params”). Then on the client: window.location.href = “[http://localhost:8080/my-api/authorize](http://localhost:8080/my-api/authorize)”

---

<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:** [September 7, 2024, 12:51am UTC](https://community.auth0.com/t/cors-issues-with-authorize/90667/5 "2024-09-07T00:51:37Z")

</div>

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