I'm trying to implement Sanctum SPA Authentication. I'm getting the following error when trying to login (only in production):
production.ERROR: Session store not set on request. {"userId":1,"exception":"[object] (RuntimeException(code: 0): Session store not set on request. at /app/vendor/laravel/framework/src/Illuminate/Http/Request.php:483)
Followed all the steps in the documentation. First calling sanctum/csrf-cookie
GET request, then my API login
POST request with the session cookie attached. Thank you for any tips!
My login
method in AuthController.php
, where the exceptioin is happening on line 28.
My Http\Kernel.php
file with the middleweres for the API endpoints.
My API endpoint in routes/api.php
The authentication routes must be in the routes/web.php
file.