1
I am trying to access an API, by Postman, it works and returns json normally, already by code (using Vuejs + Axios) does not return, from CROSS error, how can this? where Axios returns normally?
let headers = {
'Authorization': 'AUTENTICACAO BASIC',
'Content-Type': 'application/json'
}
axios.post('URL DA API', body, headers)
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
In the body
, I am sending the necessary data for the return.. Lembando that in Postman, returns the json correctly.
The return is the error 401
Can you change the API to give your application access? If you can’t, you can add a proxy to your application.
– Bruno
you can specify the urls that can access your API, using the Annotation @Crossorigin(url) , that’s the reason for the error
– Pedro Henrique Silveira