Search code examples
amazon-web-servicesamazon-cognitoamazon-cognito-triggers

Migrating social accounts (Google, Facebook) using AWS Cognito Migration Triggers


We have a Cognito user pool that we'd like to migrate to a new User Pool to take advantage of some different configuration. However, our pool contains users signed up with email, Google, and Facebook.

I understand how to migrate email/password accounts, but I do not understand how social accounts should be migrated.

From this issue, I can see that there's no way to use a different auth flow, so I'm guessing there's also some limitation surrounding social accounts as well?

One method that we had thought of would be to actually manually import the social accounts. Is this the correct way to handle migrating social accounts to a new pool? Is there a different "AWS Sponsored" method? Any help would be appreciated!

Thanks!


Solution

  • Commenting back with a solution that ultimately would have worked, but we are now starting to pick up a different auth provider instead, so opted not to do this.

    The method that we would have used is to create the user in the new Cognito pool as a Cognito Native user. Then, during social sign in, you simply need to link the social account to the Cognito Native user.

    For anyone just starting out with Cognito, I would highly recommend that you set up your presignup trigger to always create a Cognito Native user for each social sign in and link the accounts together right away. This will save you an enormous headache later on when you have duplicate accounts or need to migrate.

    For reference, this answer describes how to set up the presignup trigger to handle the linking.