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

dlook's avatar
Level 4

Keep session across multiple instances

So I have a weird client; they have 5-6 Laravel sites (across a couple different servers, and domains/subdomains). Some of them use the same database (and app key) some have access to that database through an additional protected $connection. Some of them use default auth, a couple of use Sanctum token. All of them use file for session_driver.

What they want is if someone logs into site A, when they go to site B that has access to the same database - to retain the auth.

Is it possible, any suggestions?

0 likes
3 replies
Leeeeeeelo's avatar

Hey there,

I believe the design / solution architecture is not clean. Each app should be a closed box, they shouldn't be sharing the same app key.

To provide a single sign on experience across the sites, a good idea would be to build APIs for that purpose.

dlook's avatar
Level 4

@martinbean What do you mean why? I've already said the client wants if someone logs into site A (CRM) then goes to site B (marketing materials) site would recognize them without logging again.

@leeeeeeelo This is not a question of belief, but the question on how to do it. Care to expand on "APIs" for that purpose?

Please or to participate in this conversation.