4

In my app, I have Amazon Cognito Hosted UI configured to handle Authentication by email and social (facebook and google).

The problem:

When a user create an account by email (ex: gmail) and later sign up by social (ex: same gmail), I have two accounts created in Cognito.

Question:

How merge these two accounts created with the same email?

Thanks for your help.

Edit

For those interested, I created an issue on aws amplify: https://github.com/aws-amplify/amplify-js/issues/2754

Johan Rin
  • 1,900
  • 2
  • 20
  • 42
  • 1
    You can create a pre-sign up lambda and use `adminLinkProviderForUser` to merge two accounts. Refer: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminLinkProviderForUser.html – Jishnu Feb 06 '20 at 09:25
  • Does this answer your question? [AWS Amplify: How to map social providers attributes for an email based authentication?](https://stackoverflow.com/questions/61687229/aws-amplify-how-to-map-social-providers-attributes-for-an-email-based-authentic) – dfranca Jul 11 '20 at 00:42
  • The anwser is here: https://stackoverflow.com/a/59642140/1704104 – Bruno Negrão Zica Dec 02 '20 at 01:31

1 Answers1

0

You cannot link them however you can decide the behavior by setting the forceAliasCreation parameter in ConfirmSignUp API. If you set it as false it will throw an error if a user has already registered with same email/phone number. If you set it as true, the old account will be deactivated and the new one will be the only one he can use. You can read more about this behavior here

Ninad Gaikwad
  • 4,272
  • 2
  • 13
  • 23