Search code examples
amazon-web-servicesamazon-cognito

Migrating Cognito Users


I am looking into migrating my users to Amazon Cognito.

I saw this answer and others and in particular this post from the cognito documentation.

Everywhere they are documenting flaws for authenticating and even using the "forgot my password" functionality:

Authentication flaw:

enter image description here

Remember my password flaw:

enter image description here

Problem is: I can't find any documentation on how to handle the new signUps for my users.

Even the "User Migration" hook in the user pools dashboard only mentions

This trigger is called during login and password forgotten operations to migrate users from your existing directory to this user group.

I feel like I should add something like:

enter image description here

But because I can't see this kind of middleware not documented anywhere, I'm not sure if this is good practice or if I'm just missing something...

Does anyone have experiences with this kind of problem?


Solution

  • Nope- you're not missing anything.

    On the PreSignup trigger it's your responsibility to do a lookup on your existing (non-Cognito) database and throw if the user already exists.

    I guess the Cognito team makes the assumption that someone who's already a user would probably not try to sign-up again, so it's a bit of an edge case. However it's an edge case that I (and I expect many others) put in a workaround for.