I'm doing an API get request via axios to an Exchange Rates API
axios.get('https://api.exchangerate-api.com/v4/latest/USD').then(res=>console.log('res',res)).catch(err => console.log('err',err))
And I'm getting the correct answer in the network
But this is what shows on in my console for de ERR of the get request
I've researched that CORS message and all they say is, that you have to configure your server to accept the authorization header, but thats not an API to my server, it's a third party's server
What can I do?
UPDATE
I changed from "axios" from js "fetch" and it worked! I think maybe it was a default axios configuration that was causing the problem
It can't be done in a browser application(cross is only for browsers).
It is a 3rd party so the only way to send request is by not having an origin =>> Have a server(nodejs application) sending the request in there and returning the response.
You send a request to your server => server returns the response from the corss blocked => done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.