Lucas
Lucas

Reputation: 107

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.

Already tried :

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).

Upvotes: 1

Views: 1156

Answers (2)

Nigel Atkinson
Nigel Atkinson

Reputation: 670

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

Upvotes: 1

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

Upvotes: 1

Related Questions