Laravel 5.4 session token changes on every request

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Laravel 5.4 session token changes on every request



I have a project on Laravel 5.4 and PostgreSQL. At each page request, the session is renewed with a new _token key and a new cookie. As a consequence, either authentication nor flash sessions message are not working.


_token



Already tried :


$domain


encrypted => false/true


routes.php


middleware


middlewareGroups



The RouteServiceProvider.php :


protected function mapWebRoutes(Router $router)

$router->group([
'namespace' => $this->namespace, 'middleware' => 'web',
], function ($router)
require app_path('Http/routes.php');
);



(there is no web.php/api.php, etc... PHP files, the developper remapped all these files into routes.php).




2 Answers
2



Your domain is invalid. You need to look at config.session.domain and config.session.path.


config.session.domain


config.session.path





config.session.domain had a typo, but I also deactivated DNT (Do Not Track) on my browser and the problem has gone away. Such a weird problem. Thanks !
– OverSpeed301
Aug 19 at 8:47


config.session.domain



Your browser will not store cookies for a domain without a dot. E.g. localhost. A simple fix is to add 'localhost.com' to your hosts file as 127.0.0.1.



Then you can use for example: localhost.com:8080






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard