【问题标题】:"Callback is not a function" error while changing the Password更改密码时出现“回调不是函数”错误
【发布时间】:2021-03-17 04:23:21
【问题描述】:

我正在使用 cognitoreactjs 实现更改密码。

cognitoUser 是从一个通用文件导入的对象 - cognitoVariables.js

aToken - access token, 'Abcd@1234' - old password, 'Wxyz@5678' - new password

当我执行它时,我收到 Callback is not a function 错误。 你能帮我解决这个问题吗?

cognitoUser.changePassword(atoken,'Abcd@1234', 'Wxyz@5678', function(err, result){
    if (err) {
        alert("Inside Error")
        alert(err.message || JSON.stringify(err));
        return;
    }
    console.log('call result: ' + result);
});

【问题讨论】:

    标签: reactjs amazon-cognito change-password


    【解决方案1】:

    我发现它的发生是因为 cognitoUser 是一个新创建的对象,没有 accesstoken 等属性,因为登录的用户对象和新的 cognitoUser 对象是不同的,尽管用户是相同的。

    如果我们再次尝试登录,如果我们尝试重置密码,则 onSuccess 会完美运行。

    【讨论】:

      猜你喜欢
      • 2021-06-27
      • 2020-04-30
      • 1970-01-01
      • 2014-04-08
      • 2019-06-22
      • 1970-01-01
      • 2016-10-02
      • 1970-01-01
      • 2020-05-09
      相关资源
      最近更新 更多