Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cognito - User stuck in CONFIRMED and email_verified = false

How do I go about email verifying a user who is CONFIRMED yet email_verified is false?

The scenario is roughly an agent signs up user on their behalf, and I confirm the user through the admin call adminConfirmSignUp. At that point, the user cannot change their password because of the email_verified flag being false.

I can't call resendConfirmationCode because the user is already confirmed.

I can't call forgotPassword because the email_verified flag is false.

The best I can think of is deleting the user account and calling signUp (prompting them to re-enter their password or a new password), hence recreating their account.

like image 900
user1432403 Avatar asked Aug 30 '16 15:08

user1432403


People also ask

How do I confirm my email with Cognito?

Amazon Cognito can automatically verify email addresses or phone numbers. To do this verification, Amazon Cognito sends a verification code or a verification link. For email addresses, Amazon Cognito can send a code or a link in an email message. For phone numbers, Amazon Cognito sends a code in an SMS text message.

How do I verify a user in Cognito?

When a user updates their email address or phone number in your app, Amazon Cognito immediately sends a message with a verification code to a user if you configured your user pool to automatically verify that attribute. The user must then provide the code from the verification message to your app.

How do I change my status in Cognito?

In order to change a Cognito user's status from FORCE_CHANGE_PASSWORD to CONFIRMED , we have to change their password. To change a Cognito user's password, use the admin-set-password command, setting the --permanent parameter. Copied!

How do I change user attributes in Cognito?

To update a cognito user's attributes use the admin-update-user-attributes command, specifying the user-pool-id , username and user-attributes parameters.


1 Answers

Using the AWS CLI you can update the email_verified attribute:

aws cognito-idp admin-update-user-attributes  --user-pool-id eu-west-xxxxxx  --username [email protected] --user-attributes Name=email_verified,Value=true 

Here is the official documentation: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cognito-idp/admin-update-user-attributes.html

like image 79
LiorH Avatar answered Sep 20 '22 18:09

LiorH