79185321

Date: 2024-11-13 14:26:45
Score: 1.5
Natty:
Report link

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();

When I tried to log in, 401 are returned again: enter image description here

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Renars Kilis