Reputation: 11
Can I use OpenId Connect to implement SSO between two Single Page Applications (SPA)? If yes, what would be the flow.
Scenario: App1 (SPA) starts and uses one of the OIDC flows to obtain Id_token and acccess token. It then makes many REST API calls. At some later time, user clicks on a button that brings up second SPA App2. Both app belongs to same company. Can App2 utilize Id_token and access token obtained by App1 for SSO? Looking at the spec, answer appears to be NO, because these tokens are meant for a specific client. Any other flow that enables SSO between two SPAs using OIDC? or is it outside the scope of OpenId Connect, in which case we have to look at traditional propitiatory solutions like CA, IBM etc. Thanks.
Upvotes: 1
Views: 2065
Reputation: 8421
I would use the implicit flow for both apps. It could work like this:
This way, each app would get its own tokens (yes, they are released for a specific client). And the user would not be bothered by authentication for the second app. But the OIDC behavior in step 3 is not standardized and depends on implementation. For example, it may depend on what scopes the apps are requesting - if they are not the same for both apps, the OIDC could require authentication for the second app as well.
If you also need single sign out, there is a specification for that: http://openid.net/specs/openid-connect-session-1_0.html You create two iframes in your apps - one for detecting OIDC session changes and one for communication between the first iframe and the app. The specification contains even examples of the iframe documents.
Upvotes: 4