Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Reached's avatar
Level 11

Share session between domains

Hi guys,

Im trying to make my authentication session persist between multiple different domains.

I am using Laravel 5.2 default authentication and my application uses a mix of regular domains and subdomains like this:

Route::group(['domain' => '{domain}'], function () {
    // routes go in here
}

I in my session config file I changed the driver to use the database driver and I also changed the 'domain' like below:

'domain' =>  ".''  . env('APP_DOMAIN'),

When I try to visit another site, the session is not persisted. I read about a solution where you would use a get parameter in the url to share the sessionID, has anyone tried to implement something similar?

If possible I would like to avoid using a third party service for this, unless its impossible to do it without.

Thanks in advance

0 likes
1 reply

Please or to participate in this conversation.