繁体   English   中英

AWS 放大 auth.completeNewPassword() 不起作用

[英]AWS amplify auth.completeNewPassword() doesn' work

我正在使用auth.completeNewPassword()更新密码。 当我尝试更新密码时。 我得到这个错误。

TypeError: user.completeNewPasswordChallenge is not a function
    at Auth.js:865
    at new ZoneAwarePromise (zone-evergreen.js:960)
    at AuthClass.push../node_modules/@aws-amplify/auth/lib-esm/Auth.js.AuthClass.completeNewPassword (Auth.js:864)
    at AuthenticationService.updatePassword (authentication.service.ts:68)
    at CompletePasswordComponent.onSubmit (complete-password.component.ts:30)
    at CompletePasswordComponent_Template_form_ngSubmit_1_listener (complete-password.component.html:2)
    at executeListenerWithErrorHandling (core.js:21806)
    at wrapListenerIn_markDirtyAndPreventDefault (core.js:21848)
    at SafeSubscriber.schedulerFn [as _next] (core.js:37171)
    at SafeSubscriber.__tryOrUnsub (Subscriber.js:183)

这是我正在使用的代码:

    Auth.completeNewPassword(user, password, []).then((data) => {
      console.log(data);
    })
    .catch((err) =>  console.log(err));

为了传递第一个参数(用户),我将 cognito 用户存储在本地存储中,并在需要使用此方法时检索。

我设法使用 RxJS BehaviorSubject 解决了这个问题。

在这里回答了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM