Q: How to access Binance server when you’re developing a frontend app running based on a browser (e.g. a REACT APP)?
A:
Recently quite a lot of users are running into below problem.
If you initialize an HTTP request directly from client side, sometimes you’d be blocked by browser CORs policy with error msg like - " XXXX has been blocked by CORs policy". (https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
That’s because you put API-KEY in your request header which is not allowed by Binance server. Below headers are explicitly allowed currently:
“clienttype,Content-Type,lang,x-ui-request-trace,bnc-uuid”
So basically you cannot send REST request from client end directly, instead you need to set up your web server to forward your REST request which doesn’t have CORs limitation. The only requests can be initialized from client end are the ones with “NONE” security type. (https://binance-docs.github.io/apidocs/spot/en/#endpoint-security-type)