Home > Back-end >  How to allow multiple login from one platform
How to allow multiple login from one platform

Time:12-21

I hope you are doing well!

We are working on a project that consists of 3 projects/websites. It's basically something like a Management Platform for the resources, a Platform to display information and updates, and a Platform to manage both those platforms. (Something like Office365 and PowerPoint, Word, Excel where Office365 is the main application between them).

In our project, we want to integrate a navigation drawer in which the user can navigate to the different application from our 3 websites without having to re-login. In this case it would be easy. However, would there be a way that if the user access the other website from the browser (ex:"www.exameplwebsite.website2.com") we login the user directly if he was already logged in to a previous application from ours?

We thought about local storage however the local storage and cookies accessible depend on the domain we are accessing.

Is there a way to make this happen? Or would using a navigation drawer the only way possible?

(For context we will be using ReactJS)

CodePudding user response:

I think it wouldn't be that hard with JSON Web Token (JWT) for authentication. When you redirect the user from one site to the other do it with a post request and include a JWT token in it. The new site can capture that token and send the token to the browser and the browser can catch it and saves it into its own localstorage.

CodePudding user response:

I can think of two solutions ->

  1. Use micro frontends (Recommended) If all three apps have different domain names (app1.com, app2.com, app3.com) then you're right you cannot share any token using cookies and local storage. Here, You can take the login/signup pages and the navigation drawer into one parent app and load all your other apps using micro frontends.

  2. Use SSO SAML and OIDC are made for this specific purpose but this is a very complex topic. Basically, your users will need to log in once(at someplace like google or OneLogin or your own identity server)

  • Related