How to use AWS Cognito as Single-sign-on?

Viewed 10568

I have 2 sites:

  • user registration, login and other stuff (will create users in cognito user pool)
  • user profile (self-care)

Both sites are in different domain. How can I implement SSO between both sites?

2 Answers

Depending of whether or not you'll provide SSO for single domains of separate domain you can choose and approach. You can use storing the tokens (like the id token (user information) and access token (access information)) that you got from AWS Cognito, in local storage or in a cookie.

The problem with cookies is that they can only be used for a specific domain. For this reason, they only allow single domain Single Sign-On. So if you need to support multiple domains a single-cookie solution does not meet that requirement. A token-based approach (e.g., OAuth2, OpenID Connect, SAML, etc.) has multi-domain support. Tokens can be stored on local storage which can be accessed by all domains. Alternatively, multiple cookies can be used, one for each domain.

Related