Normally a 419 is a csrf mismatch. I don't know enough about your code and app to suggest. But is this a spa.
Laravel API 419 Unknown Status on Live server
Hi, I am having a Nuxt.js app and I am making an Axios request from it to my Laravel app. All the Laravel configurations are correct I suppose as the API works great on the dev server when made requests from the Nuxt app. The problem is the live server. My Laravel app is on AWS EBS and Nuxt is on AWS Amplify. I am constantly getting 419 unknown status errors on the production/live server on Nuxt. This is how my Axios request looks like,
axios.post(`${process.env.BASE_URL}/addtorecord`, {
questions: questions,
score: score,
}, {
headers:{
Authorization: "Bearer "+store.getters.getUserToken
}
}).then(res => {
console.log(res.data)
})
All the necessary configurations are done in Laravel Sanctum's domain list as well cors.php. I tried clearing the cookies but it still doesn't work.
Any suggestions?
Thanks in advance :)
For those who are still looking for the solution. I got it working by changing SANCTUM_STATEFUL_DOMAINS in .env The problem was I was making requests from a subdomain (abc.exampl.com) while SANCTUM_STATEFUL_DOMAINS accepts root domains (example.com). So just added that it works like a charm.
Please or to participate in this conversation.