Amplify-js: Is it possible to sign-in once across multiple sub-domains / apps?

Created on 9 Nov 2019  路  4Comments  路  Source: aws-amplify/amplify-js

* Which Category is your question related to? *
Auth
* What AWS Services are you utilizing? *
Cognito

Question: Is it possible to sign in once, and automatically obtain current user credentials across other subdomains / apps?

For instance,
1) Login once via app ( http://id.URLXXX.com)
2) Then access other related authorised apps (http://APP1.URLXXX.com; http://APP2.URLXXX.com)

Note that all apps are using the same Cognito User Pool and AWS Services.

Thanks, Dan

pending-close-response-required question

Most helpful comment

Yes, using the cookieStorage or custom storage options in Auth.configure.

https://aws-amplify.github.io/docs/js/authentication#manual-setup

All 4 comments

@luizdanieldesouza do all subdomains reference the same origin (e.g. CloudFront distribution)?

I would say it's not currently possible without writing some custom functionality using e.g. websockets to communicate across the clients. (You could also use AppSync as a broker for those communications if you don't want to deal with the hassle of managing client-client websockets.) But I may be missing something obvious about subdomains.

Resolving issue due to inactivity. Please let us know if you have any more questions.

@sammartinez Is there any solution to do this( SignIn across multiple subdomains )?

Yes, using the cookieStorage or custom storage options in Auth.configure.

https://aws-amplify.github.io/docs/js/authentication#manual-setup

Was this page helpful?
0 / 5 - 0 ratings