# Not able to fetch data from stardog database using react app

**URL:** <https://community.stardog.com/t/not-able-to-fetch-data-from-stardog-database-using-react-app/3087>\
**Category:** Support\
**Created:** [June 10, 2021, 9:19am UTC](https://community.stardog.com/t/not-able-to-fetch-data-from-stardog-database-using-react-app/3087 "2021-06-10T09:19:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![namannhr](https://avatars.discourse-cdn.com/v4/letter/n/a6a055/32.png) [@namannhr](https://community.stardog.com/u/namannhr)\
**Post date:** [June 10, 2021, 9:19am UTC](https://community.stardog.com/t/not-able-to-fetch-data-from-stardog-database-using-react-app/3087/1 "2021-06-10T09:19:01Z")

</div>

Hi Stardog team,

I am trying to fetch data from Stardog database using React app. System have Kerberos authentication so I have left the username and password field empty. But the browser shows error in console:

Access to fetch at "{Stardog server url}" from origin localhost:3000 has been blocked by CORS policy: 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.

Can you please provide the solution for this error ?

---

<div class="post-metadata">

**Author:** ![serge](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/serge/32/376_2.png) [@serge](https://community.stardog.com/u/serge)\
**Post date:** [June 10, 2021, 12:42pm UTC](https://community.stardog.com/t/not-able-to-fetch-data-from-stardog-database-using-react-app/3087/2 "2021-06-10T12:42:03Z")

</div>

Are you passing the proper CORS info?

Does it work if you add

```auto
Header set Access-Control-Allow-Origin: *. #Useful for troubleshooting

```

to your request.

If it works great, but I would recommend that you read up on CORS and adjust the line above for your security need.

You can also limit who can connect using CORS [Server Configuration | Stardog Documentation Latest](https://docs.stardog.com/operating-stardog/server-administration/server-configuration). By default all connection are accepted.

---

<div class="post-metadata">

**Author:** ![namannhr](https://avatars.discourse-cdn.com/v4/letter/n/a6a055/32.png) [@namannhr](https://community.stardog.com/u/namannhr)\
**Post date:** [June 10, 2021, 12:50pm UTC](https://community.stardog.com/t/not-able-to-fetch-data-from-stardog-database-using-react-app/3087/3 "2021-06-10T12:50:37Z")

</div>

Hi Serge,  
Where to add the line:  
Header set Access-Control-Allow-Origin: \*

Thanks,  
Naman

---

<div class="post-metadata">

**Author:** ![serge](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/serge/32/376_2.png) [@serge](https://community.stardog.com/u/serge)\
**Post date:** [June 10, 2021, 12:55pm UTC](https://community.stardog.com/t/not-able-to-fetch-data-from-stardog-database-using-react-app/3087/4 "2021-06-10T12:55:43Z")

</div>

Part of your HTTP header. Here a good resource for how to work with CORS [Cross-Origin Resource Sharing (CORS) - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [June 24, 2021, 12:56pm UTC](https://community.stardog.com/t/not-able-to-fetch-data-from-stardog-database-using-react-app/3087/5 "2021-06-24T12:56:29Z")

</div>

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