amazon-cognito-identity-dart-2 icon indicating copy to clipboard operation
amazon-cognito-identity-dart-2 copied to clipboard

Confirmed user error on first sign attempt, but not on second and so on.

Open razrinn opened this issue 2 years ago • 3 comments

Hi @furaiev, this issue is related to #165.

Confirmed user case:

  1. Tried to sign in for the first time
  2. Got thrown an error CognitoUserConfirmationNecessaryException with user's session inside the error object, full error log:
CognitoUserException: User Confirmation Necessary
  1. Tried to sign in again
  2. The error is now gone

Actual unconfirmed user:

  1. Tried to sign in
  2. Got thrown an error CognitoClientException instead, full error log:
CognitoClientException{statusCode: 400, code: UserNotConfirmedException, name: UserNotConfirmedException, message: User is not confirmed.}

razrinn avatar May 22 '22 16:05 razrinn

Facing same issue

byshy avatar Jun 02 '22 09:06 byshy

Same issue here!

CristopherVidalMachado avatar Aug 30 '22 20:08 CristopherVidalMachado

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.

furaiev avatar Aug 30 '22 20:08 furaiev

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 :)

image

anthonybouton avatar Mar 18 '23 21:03 anthonybouton

@anthonybouton thank you for your contribution, your changes are available as of 3.3.0

furaiev avatar Mar 20 '23 09:03 furaiev