How can I edit a phone number of a user in user pool of `AWS cognito` before the user is authenticated?

Question:

I using AWS cognito to verify the user’s phone number. I have a problem:
When the user enter his details, I send it to AWS.
AWS try to send code to the user’s phone number, but if the user enter a wrong number AWS return exception “invalid phone number”. So I ask the user to update the number, but when I try to update it in AWS, they return exceptionthe user is not authenticated“. How can I update the number to the right number after the user just signup and still not confirmed?
This is my code:

Answer:

Currently this usecase is not supported by Cognito because customer needs to be signed-in to update the phone number and unconfirmed accounts cannot sign-in.
One option is to let user create a new account with the correct email address. Another option is that end user contacts developer, developer can use AdminUpdateUserAttributes to update the user phone number.

Leave a Reply