question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Amplify with Angular - User is not authorized to change password when using Cognito Hosted UI

See original GitHub issue

Describe 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:

  1. Sign in with the Cognito Hosted UI (for instance Google)
  2. Go to the User profile > Change password
  3. Type the old password and the new password
  4. Click on ‘Change password’ button
  5. 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:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
johanrincommented, Jan 28, 2019

Any updates on this?

0reactions
github-actions[bot]commented, Jun 12, 2021

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 *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found