我收到以下错误:
TypeError:无法读取未定义的属性'completeNewPasswordChallenge'。
按照我的代码
login(Email, Password) {
var authenticationData = {
Email,
Password
};
this.cognitoUser = this.getCognitoUser(Email);
let authenticationDetails = new AuthenticationDetails(authenticationData);
return new Promise((resolve, reject) => {
this.cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function(result) {
this.setCredentials(result.getIdToken().jwtToken);
resolve(result);
},
onFailure: function(err) {
reject(err);
},
newPasswordRequired(userAttributes, requiredAttributes) {
debugger;
console.log("newPasswordRequired()");
console.log(userAttributes, requiredAttributes);
this.cognitoUser.completeNewPasswordChallenge(
Password,
{},
authenticationData
);
}
});
}).then(() => this.getUserData());
}