Cognito: redirect to other domain and keep authentication

Viewed 277

I have two Angular applications on two separate domains that use AWS Amplify for authentication.
They both use the same Cognito user pool and the same Cognito app client.
The app client does not use the Cognito hosted UI and does not use OAuth 2.0.
The authentication protocol is the default AWS Amplify one: SRP (Secure Remote Password protocol).

Sometimes my users log in to domain1 when in fact they should be logging in to domain2 (business rule, depends on the user's profile).
In such cases, I would like them to be redirected to domain2 and be automatically authenticated.

Is there a clean way to do such a redirection with Cognito? I have a solution which implies passing Cognito tokens from domain1 local storage to the redirect url, and then doing the opposite in domain2, but clearly this feels like a hack.

0 Answers
Related