Hello Team,
We have a question regarding single sign on (SSO).
Our aim is to build a main application, like a panel, from which users can access other applications just by clicking a button. Users should authenticate in the general panel and from there, have immediate access to the other applications without having to authenticate for each one of them.
Every application (the main app and the mini apps) has its own subdomain, its own login and is connected to a particular App client in the same Cognito User Pool. The login can be made by entering username and password, or with Google. All App Clients have the same Allowed callback URLs.
We can see that when the user logs in using username and password, the information about cognito user is saved in localStorage and that the LastAuthUser, idToken and accessToken are the values needed for the authentication. On the other hand, when he logs in with Google, only federatedInfo gets saved: ({"provider":"google","user":{"id":"identityId"}}).
What is the best way to avoid that the user has to login in each one of the apps if he has already logged in the main app? How can we share his session across different apps?
At present we found a temporary solution but it doesn’t seem to be the best. Nowadays, the user logs in in the main app and we save localStorage values from Cognito. Then he clicks on the button of another app and gets redirected to it, sending cognito values as params. In the second app we receive those values, save them in localStorage and the user gets automatically logged in. So login is kinda working but we want to find a better solution. If a user logs in the main app and then goes to another app, how does the second app know that he has already logged in the first one without having to pass cognito values as params? Is there any way to find if a particular browser is logged in an Identity Pool?