Borislav Hadzhiev
Fri Sep 24 2021·2 min read
Photo by Ryan Moreno
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 john@gmail.com --user-attributes Name="email_verified",Value="true"
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 john@gmail.com --query "UserAttributes"
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.