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

david19's avatar

Auto Login in 3 Laravel Applications

Hello Team,

I have 3 Laravel Applications. Laravel1 Laravel2 Laravel3

The Users register on Laravel1, and they have automatic account in Laravel2 and Laravel3 with the same email and password. This works!

But now i will create two links on Laravel1 —> for visit Laravel2 and Laravel3.

Now the user must login again in Laravel2 and Laravel3, with the same password. The user must type password again :(

What is the best approach for this problem? I can not store the password in Plain Text with session on Laravel1. This is not secure.. Also i can not send via request to Lara2 and Lara3, because it will display the plain password in browser.

0 likes
1 reply
s4muel's avatar
s4muel
Best Answer
Level 50

some time ago (i mean, there might be a package for it already) i used JWT for similar purpose. this library: https://github.com/firebase/php-jwt

  • on L1 generate a JWT (that is basically a string) with a short expiration time with a user_id in payload
  • add this string to a URL from L1 to L2 (or L3)
  • on L2, validate this string and decrypt it using the same key from step 1 (set in both .env, not sent via URL)
  • log in the user with the user_id
1 like

Please or to participate in this conversation.