L
L
lemonlimelike2018-07-09 17:57:37
Laravel
lemonlimelike, 2018-07-09 17:57:37

How to fix the error: Session store not set on request?

I'm trying to log in, but the following error occurs:
5b43779776bca968987929.png
Here are my roots:
5b4377af673ad568896431.png
Well, the controllers are those in the Laravel boxes, registration is normal, but authorization is not. The roots are in the api.php file.
I looked in Google, you need to type these roots into:

Route::group(['middleware' => ['web']], function () {

});

wrapped, now the error and the server error number is 419, and with registration also:
5b4377dddd5a0626046304.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
JhaoDa, 2018-07-09
@lemonlimelike

https://www.google.com/search?q=laravel+419

V
Vladislav Nagorny, 2018-07-09
@esvils

Look at the file RouteServiceProvider, at the block mapWebRoutesand mapApiRoutes, they have different groups middleware's.
Let 's apisay there are no cookies and sessions, etc.

D
dmalapsh, 2021-12-07
@dmalapsh

Although a lot of time has passed, I will still write a solution that helped me in this matter.
In the app/Http/Kernel.php file, you need to edit the api group as follows

'api' => [
          \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
          'throttle:api',
          \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

You also need to set up sessions, for this: in .env in APP_URL you need to register the real url of the application and check the correct configuration of config/session.php
Here is a link that I think will be useful https://laravel.com/docs/8.x/sanctum# spa configuration

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question