R
R
RMate2019-01-18 09:36:28
Laravel
RMate, 2019-01-18 09:36:28

Why does 419 error occur when cross-domain authorization in laravel?

Hello! Installed laravel 5.7.2, rolled up basic authorization (make:auth), made migration. At this stage, everything is working correctly.
Then I registered SESSION_DOMAIN=.localhost in the config - I started getting an error:

419 Sorry, your session has expired. Please refresh and try again.

I tried to store sessions in files, in cookies, in the database. in any of the options with SESSION_DOMAIN=localhost - everything works fine, it's worth changing to .localhost or *.localhost - I catch this error.
Of course, I cleared all caches, including the browser one.
PS: what else is interesting, when you try to log in, a session is created.
Laravel version 5.7.2
PHP version 7.2
OS: Win7 x64
MySQL: 5.7.20
Apache 2.4
Please tell me what I'm doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RMate, 2019-01-18
@RMate

I found the answer myself. Oddly enough, it didn’t start on the localhost, but everything worked on the real domain.
Specified as follows:
SESSION_DRIVER=database
SESSION_DOMAIN=.site.ru

Then you need to reset all caches, both server and browser. And clear ALL cookies, including subdomain cookies.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question