user4655002
user4655002

Reputation:

Route subdomain keeping the user logged in for subdomains

So I have a sub-domain, let's say for example:

Route::domain('test.localhost')
    ->group(function () {

    Route::resource('test', 'Wallet\WalletController');

});

If my user is logged in a http://localhost but visits the test.localhost, it redirects them to the login page. Is it possible to keep the user logged in for sub-domains too?

Upvotes: 0

Views: 547

Answers (1)

PKeidel
PKeidel

Reputation: 2589

Sessions are bound to domains. Under config/session.php you must have 'domain' => env('SESSION_DOMAIN', null),.

Then put SESSION_DOMAIN=.localhost in your .env file and it should work for all subdomains and the main domain.

Sessions can be restricted on the path also.

enter image description here

Upvotes: 1

Related Questions