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

jakeryansmith's avatar

Carry authenticate from one site to another

I have two applications on one server, both at different sites. I was wondering if anyone knew how I could login on one site and then be redirected to the other site and stay logged in?

0 likes
4 replies
rodrigo.pedra's avatar

I had a similar problem last year in the startup I worked last year. Our solution was to have the sessions stored using memcached served by a third server accessible by both of the app servers.

In our case we wanted to carry the user's session from a PHP webapp to a node.js submodule, but all the servers were in the same infrastructure.

It should work, but if one of your app servers is in a different infrastructure I imagine there could be a performance hit by using this strategy.

1 like
rodrigo.pedra's avatar
Level 56

By site do you mean like different apps? I assumed different sites location like AWS New York or AWS São Paulo. Sorry :)

If they are all in the same server it should work if you use the same APP_KEY (look in your .env file) and the same cookie identifier (look in your config\session.php file for the cookie key) in both apps. Actually I tested locally and it worked.

But it does not seem to be a good idea from a security point of view.

jakeryansmith's avatar

@rodrigo.pedra Security was my main concern, so maybe I will just need to re-think how I'm doing things. Thank you for showing how it's possible though.

Please or to participate in this conversation.