How to get and update user attributes AWS amplify angular 6

Question:

How would I change the attributes of the Cognito user after sign up into the application? What API should be used to fetch the details of the user like First Name, Last Name etc?
What API should be used to update the user details?

Answer:

To fetch the details of the user, simply use this.amplifyService.auth().currentAuthenticatedUser() and retrieve the user.attributes fields.


To update the attributes, use the updateUserAttributesmethod.

If you need to retrieve the CognitoUser, you can follow the Change password example of the documentation :

Leave a Reply