We have a Cognito
user pool that supports login with email and phone number. Using Auth.verifyCurrentUserAttributeSubmit we are able to successfully verify code received on email for email change of logged in user. However the same verifyCurrentUserAttributeSubmit
method returns InternalErrorException
from Cognito when verifying phone_number
attribute using the code received on sms. Wondering how to verify the phone_number
change using Amplify?
Based on HTTP response from Cognito
, something internally failed and seems to be a bug in Cognito but not sure if there is a work around. Interesting, it's able to verify email
attribute.
From browser console, here is the curl equivalent snippet for the call made from Amplify in ReactJS app. The same API works fine if AttributeName being verified is email.
curl 'https://cognito-idp.ap-southeast-1.amazonaws.com/' \
-H 'authority: cognito-idp.ap-southeast-1.amazonaws.com' \
-H 'cache-control: max-age=0' \
-H 'content-type: application/x-amz-json-1.1' \
-H 'x-amz-target: AWSCognitoIdentityProviderService.VerifyUserAttribute' \
-H 'x-amz-user-agent: aws-amplify/5.0.4 js' \
--data-raw '{"AttributeName":"phone_number","Code":"713032","AccessToken":"xxxtokenxxxx"}' \
--compressed
Response:
{"__type":"InternalErrorException","message":"Internal server error."}