# CORS issue with React / graph.cool project on localhost

**URL:** <https://community.auth0.com/t/cors-issue-with-react-graph-cool-project-on-localhost/8397>\
**Category:** Get Help\
**Tags:** nodejs, react, localhost, cors, authentication\
**Created:** [October 5, 2017, 8:17pm UTC](https://community.auth0.com/t/cors-issue-with-react-graph-cool-project-on-localhost/8397 "2017-10-05T20:17:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxim.zubarev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/maxim.zubarev/32/7324_2.png) [@maxim.zubarev](https://community.auth0.com/u/maxim.zubarev)\
**Post date:** [October 5, 2017, 8:17pm UTC](https://community.auth0.com/t/cors-issue-with-react-graph-cool-project-on-localhost/8397/1 "2017-10-05T20:17:39Z")

</div>

I am trying to get auth0 working in my local project. I googled the CORS issue and it seems you have to enable the proper URLs in the auth0 client settings, which I did though. It seems I keep overseeing something. Please have a look at following screenshots and code:

- Here is my request:  
[Dropbox](https://www.dropbox.com/s/zbute0o0x3ufkbp/Screenshot%202017-10-05%2014.34.22.png?dl=0)
- The response:  
[Dropbox](https://www.dropbox.com/s/mrkylgeiq6o7xwn/Screenshot%202017-10-05%2015.06.48.png?dl=0)
- My CORS client settings:  
[Dropbox](https://www.dropbox.com/s/swq48tjfqe6ov60/Screenshot%202017-10-05%2014.41.46.png?dl=0)
- There is an advanced setting related  
to CORS but I can’t seem to use  
localhost there:  
[Dropbox](https://www.dropbox.com/s/dcuxsob14owmi82/Screenshot%202017-10-05%2014.42.08.png?dl=0)
- Here is my code:  
[Auth0.com authentication · GitHub](https://gist.github.com/mxmzb/103e10d199804da717c7b5de1e451d7b)  
which is basically taken from example  
code here:  
[https://github.com/auth0-samples/auth0-react-samples/blob/embedded-login/01-Embedded-Login/src/Auth/Auth.js](https://github.com/auth0-samples/auth0-react-samples/blob/embedded-login/01-Embedded-Login/src/Auth/Auth.js)

I would really love to use auth0 in this project, so I appreciate any hints. Thank you in advance!

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [October 6, 2017, 6:24pm UTC](https://community.auth0.com/t/cors-issue-with-react-graph-cool-project-on-localhost/8397/2 "2017-10-06T18:24:58Z")

</div>

You’re trying to make use of [cross-origin authentication](https://auth0.com/docs/cross-origin-authentication) and the associated setting (_Cross Origin Authentication Location_) does not allow just `localhost` in the URL. According to the current placeholder it expects `https://domain.tld/path`. I don’t have additional information about the reasoning for this limitation, but **for development purposes you can just use something like `https://cool.localtest.me:{port}`** ; except for `readme.localtest.me` (which explains how to use it) every other sub-domain of `localtest.me` **points to `127.0.0.1` by default so you can use it to target your local app** (and if you’re paranoid about the real owner changing things under you then you can always force a specific one to always map to your local machine through an hosts entry). This way you avoid the constraint on the setting.

---

<div class="post-metadata">

**Author:** ![bernard.logan4](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bernard.logan4/32/7564_2.png) [@bernard.logan4](https://community.auth0.com/u/bernard.logan4)\
**Post date:** [January 4, 2018, 10:36pm UTC](https://community.auth0.com/t/cors-issue-with-react-graph-cool-project-on-localhost/8397/3 "2018-01-04T22:36:16Z")

</div>

@jmangelo I’m having the same CORS issue as @maxim.zubarev, even after using `http://cool.localtest.me:3000`. Have tried other browsers with the same result.

---

<div class="post-metadata">

**Author:** ![bernard.logan4](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bernard.logan4/32/7564_2.png) [@bernard.logan4](https://community.auth0.com/u/bernard.logan4)\
**Post date:** [January 4, 2018, 10:36pm UTC](https://community.auth0.com/t/cors-issue-with-react-graph-cool-project-on-localhost/8397/4 "2018-01-04T22:36:16Z")

</div>

@jmangelo I’m having the same CORS issue as @maxim.zubarev, even after using `http://cool.localtest.me:3000`. Have tried other browsers with the same result.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [January 4, 2018, 11:14pm UTC](https://community.auth0.com/t/cors-issue-with-react-graph-cool-project-on-localhost/8397/5 "2018-01-04T23:14:33Z")

</div>

My answer focused a bit on the issue about the inability to use localhost in one the settings shown in the screenshot, however, that’s only part of the equation. Depending on tenant configuration there are a few settings that can influence CORS; the first thing to ensure is to have set Allowed Web Origins correctly. If that does not affect the end result then you should probably submit your question with information about endpoints being called, endpoint that fails with CORS and client configuration.

---

<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:** [March 2, 2018, 5:56am UTC](https://community.auth0.com/t/cors-issue-with-react-graph-cool-project-on-localhost/8397/6 "2018-03-02T05:56:50Z")

</div>


