jonsaw / amazon-cognito-identity-dart

Unofficial Amazon Cognito Identity Provider Dart SDK, to easily add user sign-up and sign-in to your mobile and web apps with AWS.
MIT License
205 stars 93 forks source link

Is it possible to check if the user/email already exists #73

Open mschewe opened 4 years ago

mschewe commented 4 years ago

I would like to have a two step sign-up. First the user should enter it's E-Mail. If the E-Mail is already known, the user should be asked for his password. If the user is unknown, it should show the password and password_confirmation field. Is this possible?

The only way I found is to use a wrong password and then catch the error:

userPool.signUp('email@example.com', 'veryunlikelypassword');
-----
ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: CognitoClientException{statusCode: 400, code: UsernameExistsException, name: UsernameExistsException, message: An account with the given email already exists.

But this doesn't seem right. Is there an alternative?

EDIT: Stupid from my side. That would register the user with that password :man_facepalming: