How to Verify a Cognito User's Email


Borislav Hadzhiev

Fri Sep 24 20212 min read


Photo by Ryan Moreno

Verify a Cognito User's Email #

We need to verify a cognito user's email because otherwise they can't use the forget password and other functionality.

In order to verify a cognito user's email, we have to set their email_verified attribute to true. To set their email_verified attribute to true we can use the admin-update-user-attributes command.

aws cognito-idp admin-update-user-attributes --user-pool-id YOUR_USER_POOL_ID --username --user-attributes Name="email_verified",Value="true"

verify user email

We're using the admin-update-user-attributes command to verify the user's email, however it can be used to update any of the cognito user's attributes.

To make sure the email of the user is verified, run the admin-get-user command.

aws cognito-idp admin-get-user --user-pool-id YOUR_USER_POOL_ID --username --query "UserAttributes"

confirm email verified

The admin-get-user command returns information about the cognito user, however we've filtered the output to only show the user's attributes, by setting the --query parameter.

Once the user's email_verified attribute is set to true, they can use the forget password functionality and get emails with confirmation codes.

Further Reading #

Use the search field on my Home Page to filter through my more than 1,000 articles.