0
Personal need to consume a third party API with Javascript, I do not have access to release Cors in the API.. and this error is appearing as I can solve ? I have the following request using Axios: Obs: when I make the request in Postman it’s working.
axios({
method: 'POST',
url: url,
data: {},
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'
}
}).then(res => {
console.log(res);
}).catch(err => {
console.log(err);
})
Thank you!
There is no solution on the front end. You will need to build a proxy in your back end and request through it.
– bfavaretto
Or use a public proxy as https://corsproxy.github.io/
– bfavaretto
How does this corsorigin.me ? just put before the url ? I tried here didn’t work out.. vlw..
– wDrik
As it says on the site itself, there is no way to guarantee the availability of the service. So it is better to have your own proxy. This answer has a simple example in php.
– bfavaretto