Open sts-ryan-holton opened 2 years ago
Update?
Update?
hi @sts-ryan-holton,
i think the config for your nuxt-auth should looks like this
auth: {
redirect: {
login: '/account/login/',
logout: '/account/login/',
callback: '/account/login/',
home: '/account/domains/'
},
strategies: {
'laravelSanctum': {
provider: 'laravel/sanctum',
url: process.env.API_URL,
user: {
property: 'user'
}
endpoints: {
login: { url: '/api/auth/login', method: 'post' },
logout: { url: '/api/account/logout', method: 'post' },
user: { url: '/api/auth/user', method: 'get' }
},
}
}
},
and also you need to keep calling this.$auth.fetchUser()
everytime route changed on page reload, because on my experience using this module is this module only fetch user once after using loginWith
hope this will help
Version
module: 5.0.0-1647967358.de1bb0f nuxt: 2.15.8
Nuxt configuration
mode:
Nuxt configuration
What is expected?
When a user tries to navigate to a page that performs a request requiring an authenticated user, the user should automatically be redirected to the
redirect.login
route if the response received is a 401 status code when the cookie expires.What is actually happening?
When using the Laravel Sanctum provider, and setting the
SESSION_LIFETIME
to an unrealistic 1 minute period, the customer isn't redirected to the login page when they try to access a route that requires them to be logged in. Instead, they've got to refresh their web page.Steps to reproduce
SESSION_LIFETIME=1
in the Laravel.env
fileChecklist