binance-exchange/node-binance-api

Cors Issue

shivam-880 opened this issue · 3 comments

I am trying to consume binance rest apis in a small react app. Following is the issue that I face:

Failed to load https://api.binance.com/api/v1/ticker/allPrices: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Please suggest. TIA

I think it is an issue when running in browser localhost. I used a google chrome plugin (named Allow-Control-Allow-Origin: *) to make it work on dev machine.

Yeah, no exchange lets you connect to their API from the browser or plugins unfortunately.
As nebsi mentioned, requires some sort of hack or workaround

My approach has always been to have a data source on my server, I pull from that, it pulls from binance. Annoying but works.