Closed noickare closed 1 year ago
Hi @noickare thank you for opening this issue.
What you described is the expected behavior since a user account needs to be confirmed before any authentication can be performed.
Could you describe more of your use case, and why you are expecting authentication to be performed before a user is confirmed?
Thanks for the response @nadetastic. When a user exits the authentication flow before completing account confirmation, the next time they try to log in UserNotConfirmedException will be thrown and can be redirected to an account confirmation flow where they will enter a verification code. The problem comes in when we want to automatically sign in the user after confirmation. Seems the only way to do this at the moment is to store the credentials entered during login on local state and try to use the same credentials to login the user after verification, incase the credentials entered were incorrect, the account will be confirmed indeed but the login will fail due to the incorrect credentials.
@noickare thanks for providing the context. In order to have NotAuthorizedException be thrown before UserNotConfirmedException if the password is wrong, first verify that your AppCient has "Prevent user existence errors" enabled. With this enabled UserNotConfirmedException
will only be thrown if the password is incorrect. Can you verify you have this enabled? and if not could you enable it?
Thank you so much @nadetastic after enabling Prevent user existence errors it works as expected
@noickare glad we work able to get this configured and working as expected. I'll go ahead and close out this issue.
Thank you!
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
Trying to authenticate a user after email confirmation. The best recommended approach as I saw from other issues is storing the the password field in a local state and then doing Auth.signIn to signin the user once more. The problem comes in when a user exists the app after signup without verification and next time they signin am redirecting them to the verification screen if UserNotConfirmedException is thrown. The problem comes in where UserNotConfirmedException is thrown even if the password input is wrong instead of NotAuthorizedException exception and Auth.signIn fails after verification.
Expected behavior
NotAuthorizedException should be thrown before UserNotConfirmedException if the password is wrong
Reproduction steps
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response