Answer the question
In order to leave comments, you need to log in
Laravel Sanctum is not giving out csrf-cookies, what should I do?
I am developing a bunch of sites site.ru (nuxt) and api.site.ru (Laravel 8 + Laravel Sanctum).
I made test authentication on site.ru. The request to get a csrf-cookie succeeds, but when it comes to api.site.ru/login it gives the following error with a 419 response:
CSRF token mismatch.
'paths' => [
'api/*',
'login',
'logout',
'sanctum/csrf-cookie'
],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => true,
axios: {
baseUrl: process.env.API_URL,
credentials: true,
},
auth: {
strategies: {
cookie: {
cookie: {
name: 'XSRF-TOKEN',
}
},
'laravelSanctum': {
provider: 'laravel/sanctum',
url: process.env.API_URL
},
},
redirect: {
login: '/login',
logout: '/logout',
callback: '/login',
home: '/'
}
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question