Amplify with Angular - User is not authorized to change password when using Cognito Hosted UI
See original GitHub issueDescribe the bug In my Angular project, User is not authorized to change password when using Cognito Hosted UI
To Reproduce Steps to reproduce the behavior:
- Sign in with the Cognito Hosted UI (for instance Google)
- Go to the User profile > Change password
- Type the old password and the new password
- Click on ‘Change password’ button
- See the error ‘User is not authorized to change password.’
Expected behavior The user password is changed.
Desktop (please complete the following information):
- OS: macOS Mojave v 10.14.2
- Browser: Chrome Version 71.0.3578.98 (Build officiel) (64 bits)
Additional context Excerpt of my change password code:
this.authService.currentAuthenticatedUser().pipe(
switchMap((user: any) => this.authService.changePassword(user, oldPassword, newPassword)),
takeUntil(this.ngUnsubscribe)
).subscribe(...)
You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app.
ConsoleLogger.js:78 [DEBUG] 03:54.68 AuthClass - getting current authenticted user
ConsoleLogger.js:78 [DEBUG] 03:54.69 AuthClass - cannot load federated user from auth storage
ConsoleLogger.js:78 [DEBUG] 03:54.71 AuthClass - get current authenticated userpool user
ConsoleLogger.js:88 [DEBUG] 03:54.74 AuthClass - Getting the session from this user: CognitoUser {username: "Google_111080149448678951***", pool: CognitoUserPool, Session: null, client: Client, signInUserSession: CognitoUserSession, …}
ConsoleLogger.js:88 [DEBUG] 03:54.77 AuthClass - Succeed to get the user session CognitoUserSession {idToken: CognitoIdToken, refreshToken: CognitoRefreshToken, accessToken: CognitoAccessToken, clockDrift: 0}
zone.js:1050 POST https://cognito-idp.eu-central-1.amazonaws.com/ 400
(anonymous) @ zone.js:1050
request @ Client.js:47
changePassword @ CognitoUser.js:845
(anonymous) @ Auth.js:1317
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:388
onInvoke @ core.js:16156
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:387
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:138
(anonymous) @ zone.js:872
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:421
onInvokeTask @ core.js:16147
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:420
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:188
drainMicroTaskQueue @ zone.js:595
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:500
invokeTask @ zone.js:1540
globalZoneAwareCallback @ zone.js:1566
ConsoleLogger.js:88 [DEBUG] 03:54.147 AuthClass - change password failure {code: "NotAuthorizedException", name: "NotAuthorizedException", message: "User is not authorized to change password."}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Using the Amazon Cognito hosted UI for sign-up and sign-in
Integrating a mobile or web app into your Amazon Cognito user pool. ... The Amazon Cognito Hosted UI provides you an OAuth 2.0...
Read more >Authentication with Cognito Hosted UI | AWS | Angular
Authentication with AWS Cognito Hosted UI AWS and AngularGithub Repo - https://github.com/mjzone/ebuy-youtube⭐️ Hey guys, if you find this ...
Read more >Amplify - Passing cognito user object to another component
The problem is the result returned is of type CognitoUser. This need to be passed to the reset-password component. I tried saving result...
Read more >Authentication - Password & user management - JavaScript
The user is asked to provide the new password and required attributes during the first sign-in attempt if a valid user directory is...
Read more >The Complete Guide to User Authentication with the Amplify ...
Amazon Cognito makes this process easy by allowing you to use a single ... This function will render the Hosted UI that will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Any updates on this?
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
*-helpchannels or Discussions for those types of questions.