Sorry to bother all of you. I have searched many times. I tried the probable solution too. I have set the csrf_token using meta tag
<meta name="csrf-token" content="{{ csrf_token() }}">
My POST request is like the below
tryAuth () {
if (this.$refs.form.validate()) {
let _this = this
axios.post('/trylogin',_this.loginInfo, {
headers: {
//'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
},
//withCredentials: true
}).then(function(response){
console.log(response.data)
})
.catch(function(error){
})
}
I have tried both using with and without the headers. Sometimes the response is okay but sometimes it shows 419 error response.
I am using Laravel 5.5 and AXIOS latest version. Any help would be appreciated. I have found some solution and tried but didn't work for me.
Thanks :)