I'm trying to make the request for an API, using Axios:
axios.post('http://api.teste.com.br/v1/getToken', {
withCredentials: true,
auth: {
username: 'usuario',
password: 'password'
},
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Authorization",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE" ,
"Content-Type": "application/json;charset=UTF-8"
},
}).then(resp => {
console.log(resp)
})
.catch(error => {
console.log(error)
})
But it always presents the error:
Access to XMLHttpRequest at ' link ' from origin '#
Is there any more configuration to do? Remembering that it is a third-party API and I can not change CORS on the server, and PostMan works without problems.