I've done some googling and checked this answer but am still facing a 401 Unauthorized response when consuming my own api from my laravel app from a non logged in user.
I've followed the official docs and have installed passport.
I've also have this on every axios request:
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: http://ift.tt/2hex2P1');
}
Token is also defined on my boilerplate:
<meta name="csrf-token" content="">
Why are the requests still unauthorised?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DoKDNm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire