Laravel(Homestead) Sanctum not working with Seperate Vue app

  javascript, laravel, laravel-sanctum, vue.js

I have run

 php artisan serve

and my laravel app is resolved on localhost:8000 successfully

Laravel Sanctum configuration


My vue app is resolved on localhost:8080

 async loginUser() {
    try {
    await this.$axios.get('/csrf-cookie');
    await this.$'/login', this.payload);
  } catch(error) {
    let errors =;
    for (let field of Object.keys(errors)) {
    this.$toast.error(errors[field][0], 'error');


This works and the user is logged in but GET, POST request returns a 401 unauthenticated all the time.
I’ve checked the request headers and the cookie and X-XSRF-TOKEN are sent but i get a 401 everytime.

Source: Laravel

Leave a Reply