'share user login sessions between two React applications?

I use the username, Password for authentication of a single react app. I would like for my users to log in once on either of the web apps and not have to log in again if they happen to go to the other. ( similar to how if i login on www.google.com i'm also logged in to youtube and other google sites ) enter image description here



Solution 1:[1]

To do this, you have to like how Google does it. When you login at Google (for any service) you are always redirected to https://accounts.google.com/.

On this site the user logins and then receives a long lasting session cookie. Then the user is redirected back to the service where the user may receive a second session cookie just for that service.

When the user tries to login with Service B, then the user is redirected to https://accounts.google.com/ but as the user is already logged in , then he is automatically redirected back to service B, logged in and ready. Then Service B can issue its own session cookie.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tore Nestenius