【问题标题】:AWS amplify auth.completeNewPassword() doesn' workAWS 放大 auth.completeNewPassword() 不起作用
【发布时间】:2020-06-29 16:39:23
【问题描述】:

我正在使用 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));

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

【问题讨论】:

  • 我只是猜测您还需要安装 AWS 包。
  • @Talg123 你建议什么包?

标签: angular typescript amazon-web-services aws-amplify


【解决方案1】:

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

我回答了这个问题here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-23
    • 2012-06-13
    • 1970-01-01
    • 2014-10-09
    • 1970-01-01
    • 1970-01-01
    • 2020-12-12
    • 2018-12-15
    相关资源
    最近更新 更多