S
S
syndarva2020-10-09 15:24:28
Laravel
syndarva, 2020-10-09 15:24:28

Why is the server returning Unauthenticated?

I installed Sanctum as in the documentation:

  1. I wrote composer require laravel /sanctum
  2. Registered php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
  3. Registered php artisan migrate
  4. Added EnsureFrontendRequestsAreStateful to app/Http/Kernel.php
  5. Updated .env : added SANCTUM_STATEFUL_DOMAINS=localhost and SESSION_DRIVER=cookie
  6. In the application itself, I make a request to /sanctum/csrf-cookie . Request successful. Cookies have been updated.
  7. Next, I make a request to /login . Request successful. Cookies have been updated.

And when requesting a secure auth:sanctum path, the server kicks me off with a 401 error. What have I done wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
syndarva, 2020-10-09
@syndarva

Found the reason. It was necessary to register SANCTUM_STATEFUL_DOMAINS along with the port.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question