I am using laravel airlock auth on my SPA project.
As per documentation https://laravel.com/docs/master/airlock, there is a need of the code below in loggin in:
axios.get('/airlock/csrf-cookie').then(response => {
// Login...
});
However, when I commented the code, the login script can still access the API controller.
This is my code below:
// axios.get('/airlock/csrf-cookie').then(response => {
axios.post('api/login', {
email: this.email,
password: this.password
})
.then(response => {
console.log(response);
})
.catch(error => {
self.errors.push(error.response.data.message)
});
// })
What is the use of axios.get('/airlock/csrf-cookie')
then?