hannibal1296
hannibal1296

Reputation: 15

AWS Cognito: Change the value of users' custom field

I'm working on my project and making an android app using Cognito for user management.

I tried to use it as user database so I made some custom fields like age and picture_url. But I cannot find a way to change the value of a custom field. I found the code to delete the value of field but couldn't find the one to register to an existing user.

Is it impossible to change the value of a custom field from android or lambda in python so that I need to switch to RDS to store user information?

Upvotes: 1

Views: 1794

Answers (1)

ajb3ck
ajb3ck

Reputation: 166

The Python SDK method which should work for this is CognitoIdentityProvider.Client.update_user_attributes (Python SDK AWS Docs)

For the attribute name be sure to prefix it with custom: (custom:age and custom:picture_url for the attributes you mentioned). The custom prefix is mentioned here: AWS Docs: Configuring User Pool Attributes

If you are using Client based access be sure the Client has access to modify the custom attributes. I don't believe clients which exist prior to the custom attribute being created automatically have access to modify the newly created attribute.

Upvotes: 1

Related Questions