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 解决了这个问题。
我回答了这个问题。
我正在使用 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 解决了这个问题。
我回答了这个问题