amazon-cognito-identity-dart-2
amazon-cognito-identity-dart-2 copied to clipboard
Confirmed user error on first sign attempt, but not on second and so on.
Hi @furaiev, this issue is related to #165.
Confirmed user case:
- Tried to sign in for the first time
- Got thrown an error
CognitoUserConfirmationNecessaryException
with user's session inside the error object, full error log:
CognitoUserException: User Confirmation Necessary
- Tried to sign in again
- The error is now gone
Actual unconfirmed user:
- Tried to sign in
- Got thrown an error
CognitoClientException
instead, full error log:
CognitoClientException{statusCode: 400, code: UserNotConfirmedException, name: UserNotConfirmedException, message: User is not confirmed.}
Facing same issue
Same issue here!
Hello, guys, you are welcome to debug and fix this bug if you have time and passion. Unfortunately, I'm overloaded and don't have time to do it.
This appears to be normal. I'm bumping into this "issue" also, however it seems this works as intended.
It actually has nothing to do with the User not being confirmed, the exception being thrown here is that the Users it's current device has not yet been confirmed ( bit unlucky naming on the exceptions ).
Whenever a new device is detected, depending on the settings on your user pool, you might have your users verify the logon on the new device. After one attempt, some device keys get cached which makes it "work" on the second time, again, depending on your user pool settings.
See See https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ConfirmDevice.html and https://aws.amazon.com/premiumsupport/knowledge-center/cognito-user-pool-remembered-devices/
TLDR. Either fix the exception and confirm the device as intended on an already verified device OR Disable Device tracking on your user pool settings ( Don't remember devices ) OR Always remember devices
When User Opt-in, you will bump into this "issue", which is not an issue :)
@anthonybouton thank you for your contribution, your changes are available as of 3.3.0