0

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."}
suman j
  • 6,710
  • 11
  • 58
  • 109
  • 1
    If you've attempted this multiple times and it's repeatable, only the Cognito team can answer this. If you have a support contract, provide them with your user pool id and timestamp of the request and they should be able to investigate what happened in the logs. If not submit the same info on re:post – perpil Dec 16 '22 at 04:10

0 Answers0