The "not allowed by Access-Control-Allow-Origin" message indicates an AJAX request being blocked by the browser/sandbox for security purposes. This can be bypassed by using our "jsonp" end-points (simply replace "json" with "jsonp" in the REST request). Note that the result is in the form of a javascript function call -- the name of which can be specified using an optional parameter "callback". Here is an example JSONP invocation:
Here is some further reading on the subject:
http://stackoverflow.com/questions/10143093/origin-is-not-allowed-by-access-control-allow-origin
https://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present
http://en.wikipedia.org/wiki/JSONP
For security reasons, the Developer Center APIs do not support CORS and we do not advise customers to call the APIs directly from a browser since you are passing authentication information to our servers. Doing so would potentially expose your credentials to third party servers/websites. Alternatively, many customers create a proxy server as a workaround -- one user reports they added this to their proxy header("Access-Control-Allow-Origin: *"); We strongly recommend creating a proxy server.
We do not have specific recommendations since it varies by customer environment or software framework and suggest consulting the documentation of your framework.
Here’s a link to an article for further explanation on the CORS issue:
https://jeremyliberman.com/2019/02/11/fetch-has-been-blocked-by-cors-policy.html
Comments
0 comments
Article is closed for comments.