completeNewPasswordChallenge的问题

时间:2019-04-11 20:22:26

标签: amazon-web-services amazon-cognito nuxt.js

我收到以下错误:

  

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());
  }

0 个答案:

没有答案