I am using nuxt js along with laravel passport. when I logged in it logged in successfully but it shows the above error and on refresh, it redirects to the login.
In my login.vue
methods: {
async login() {
this.error = null;
await this.$auth
.loginWith("laravelPassportPassword", { data: this.form })
.then((response) => this.$router.push("/"))
.catch((error) => (this.error = error.response.data.message));
},
},
In my nuxt.config.js
auth: {
redirect: {
home: '/',
},
strategies: {
laravelPassportPasswordGrant: {
name: 'laravelPassportPassword',
provider: 'laravel/passport',
url: '/backend',
endpoints: {
logout: '/api/logout',
user: {
url: '/api/user',
},
},
clientId: process.env.PASSPORT_CLIENT_ID,
clientSecret: process.env.PASSPORT_CLIENT_SECRET,
grantType: 'password',
},
}