我做与Cognito AmazonWebService和AngularJS我的应用程序的用户管理。AmazonWebService认证/注册
我无法弄清楚如何来解决这个问题:
注册后,用户收到一封电子邮件,其中一个代码来确认。 当我尝试输入并验证代码时,我有一个弹出消息显示“错误:用户未通过身份验证”。
但如果是我换,因为我这个错误,我不能验证自己的步骤:“您的帐户必须确认”。
编辑:这就是我如何确认登记:
var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(_poolData);
var userData = {
Username : username,
Pool : userPool
};
var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
cognitoUser.getAttributeVerificationCode('email', {
onSuccess: function (result) {
console.log('call result: ' + result);
},
onFailure: function(err) {
console.log("error");
alert(err);
},
inputVerificationCode: function(code) {
var verificationCode = prompt('Check you email for a verification code and enter it here: ' ,'');
cognitoUser.verifyAttribute('email', verificationCode, this);
}
});
我也曾经尝试下面这段代码:
var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
cognitoUser.confirmRegistration('123456', true, function(err, result) {
if (err) {
alert(err);
return;
}
console.log('call result: ' + result);
});
但每次我用你给我的代码来确认一个用户我有这样的错误消息:"ExpiredCodeException: Invalid code provided, please request a code again."
而用户在我的用户群也证实...
我怎么能解决呢?
我遇到了同样的问题,您是否找到任何解决方案? – Naren