AWS Cognito - MFA设置

Ugu*_*gur 6 amazon-web-services amazon-cognito mfa

我使用JavaScript AWS SDK进行MFA设置并遇到两个问题:首先,我更新了电话号码(phone_number属性和updateUserAttributes方法).

它更新但返回空对象而不是(根据文档):

{
    "CodeDeliveryDetailsList": [ 
    { 
        "AttributeName": "string",
        "DeliveryMedium": "string",
        "Destination": "string"
    }
    ]
}
Run Code Online (Sandbox Code Playgroud)

其次,我正在尝试向用户发送getAttributeVerificationCode带有以下有效负载的验证码:

const params = { 
  AccessToken: auth.accessToken,    
  AttributeName: 'phone_number'
}
Run Code Online (Sandbox Code Playgroud)

我正在接受

CustomMessage failed with error
Cannot read property identity of undefined
Run Code Online (Sandbox Code Playgroud)

作为错误.有任何想法吗?

Any*_*ose 0

AWS 需要字符串,也许令牌在这里传递不正确......

const params =    {
   "AccessToken": auth.accessToken.toString(),
   "UserAttributes": [ 
      { 
         "Name": "phone number",
         "Value": "(555)555-5555"
      }
   ]
}
Run Code Online (Sandbox Code Playgroud)

和这里...

const params = {
   "AccessToken": auth.accessToken.toString(),
   "AttributeName": "phone number"
}
Run Code Online (Sandbox Code Playgroud)