0

I am currently building a dashboard for chrome. I am trying to display coin prices on the dashboard by getting the information through coin gecko’s API. I get this error when I run my code "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.coingecko.com/api/v3/coins/dogecoin. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).", and get the same error when I try to execute on the coin gecko API V3 site.

This is my code:

fetch("https://api.coingecko.com/api/v3/coins/dogecoin") .then(response => response.json()) .then(data =>console.log(data)) .catch(err => console.log(err))

  • You have to add this mentioned header to the respone on the server. If you don't control the server, ask the people who do ... – derpirscher Oct 13 '21 at 17:26
  • The request in question is a [_simple_](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests) GET request, and its response contains `Access-Control-Allow-Origin: *`. Therefore, it shouldn't cause a CORS error. There must be something you're not telling us... – jub0bs Oct 13 '21 at 20:36
  • @jub0bs even when I try to execute it on the coin gecko site, I get the same error – Hakeem Braimah Oct 14 '21 at 10:07

0 Answers0