Achraf
Achraf

Reputation: 149

Check if a username exists in Cognito User pool

I want my authentication flow to meet these scenarios: check if a username exists. If it exists, then navigate to sign-in screen. Otherwise navigate to sign-up screen. I cannot find documentation on how to check if a username exists in AWS Cognito.

Upvotes: 4

Views: 4654

Answers (1)

Ninad Gaikwad
Ninad Gaikwad

Reputation: 4480

You can use adminGetUser to pass the username and user pool id. If the user exists you will get a 200 success response. Just put an if condition based on the response.

Upvotes: 2

Related Questions