-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular - authState looks to not update after completeNewPassword is being triggered #747
Comments
Ok, I was able to solve it by signing in again the user with the new password, after the completeNewPassword has been triggered.
The previous behavior doesn't sound really good, at least I am not able to understand why the authStateChange$ is not updating! |
I think the reason is is not working is there is no decorator (auth.decorator.ts) for completeNewPassword. Temp workaround is to call the following when the Auth.completeNewPassword comes back successful . Where userReturned is the user I got back from Auth.completeNewPassword. The decorators (auth.decorator.ts) are not complete, so if you for example: Something else, amplify.service.ts has private _authState = new Subject(); If what I am saying is crap, please let me know. I am trying to learn TypeScript only been busy with it for 2 days, else I would have updated the code and submitted. I don't want to be that idiot :) Thank you again for an awesome package. Much nicer than building cognito intergation it in JavaScript. |
@39ro @jan1za, @haverchuck is looking into this issue. |
@39ro @jan1za - Yes, I think this is a decorator issue. Continuing to look into it. Update - Not necessarily a decorator issue, entirely. Update 2: This was actually an issue with the amazon-cognito-identity-js package. Basically, the challengeName on the cognito user object was not getting reset after the response came back from Cognito upon completion of the completePassword function. I've submitted a PR to fix this. I'd rather not add another decorator quite yet, because under current conditions it would result in duplicate state setting. I can fix later if necessary. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Hello guys, I was trying to re-write the Angular components for AWS-amplify and I encountered a few problems with the completeNewPassword method.
Here the component provided by you: require-new-password.component.ts
if (this._auth.currentUser.challengeName === 'NEW_PASSWORD_REQUIRED')
, true redirect to "/new-password" to let him update his new password.if (this._auth.currentUser.challengeName === 'NEW_PASSWORD_REQUIRED')
as true, avoiding me to redirect the user to protected pages.Now trying to refresh the page manually the AuthState is being updated and I can now redirect the user to protected pages.
It's a couple of hours that I am struggling on it and would be happy if one of you could help me to sort out where the problem is. Thanks!
The text was updated successfully, but these errors were encountered: