In a VueJS app I am making an axios call to an API on a remote server. The server is set up to return the correct CORS headers (Access-Control-Allow-Origin, and Access-Control-Allow-Headers). It looks like the auth headers are not sent at all.
Here is the pertinent code:
var config = "auth: {username: 'username', password: 'secret'},
headers: {accept: 'application/json'}";
axios.get(self.link, config)
.then(function (response) {
self.jobDetails = response.data;
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
The accept header is sent correctly. The auth header is not sent at all. So, I get a 401.
All searches for an answer point to CORS solutions. But, I do not get the CORS preflight error. So, I think the ORIGIN request is handled correctly.
Can anyone point me in the right direction?
TIA
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire