cognitoUser.getAttributeVerificationCode引发错误“无效的lambda函数输出:无效的JSON”

时间:2019-02-26 12:16:20

标签: javascript node.js aws-lambda amazon-cognito

我一直在尝试使用Amazon Cognito中的getAttributeVerificationCode Api验证用户电子邮件。这是我的代码。

cognitoUser.getAttributeVerificationCode('email', {
onSuccess: function (result) {
  // console.log("type",typeof params.AttributeName);
  console.log('call result: ' + result)
  response = {
    statusCode: 200,
    body: JSON.stringify({ message: 'onSuccess' }),
    headers: {
      'Content-Type': 'application/json'
    }
  }
  callback(null, response)
},
onFailure: function (err) {
  // console.log(err)
  response = {
    statusCode: 200,
    body: JSON.stringify({ message: err.message }),
    headers: {
      'Content-Type': 'application/json'
    }
  }
  callback(null, response)
},
inputVerificationCode: function () {
  // var verificationCode = prompt('Please input verification code: ' ,'');
  // cognitoUser.verifyAttribute('email', verificationCode, this);
  console.log('verification code')
}

})

这将显示错误“无效的lambda函数输出:无效的JSON”。任何帮助将不胜感激。

0 个答案:

没有答案