Tried with [https://stackoverflow.com/questions/70248087/why-am-i-getting-a-csrf-token-mismatch-with-laravel-and-sanctum][previous posted link]:
Changed variables in my local .env: SESSION_DOMAIN=localhost SANCTUM_STATEFUL_DOMAINS=localhost
Moved back routes from web.php to api.php. Activated EnsureFrontendRequestsAreStateful usage with $middleware->statefulApi(); in app.php:
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__ . '/../routes/web.php',
api: __DIR__ . '/../routes/api.php',
commands: __DIR__ . '/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
$middleware->statefulApi();