Reputation: 1168
I'm creating a tiny API using Cognito & Lambda. I would like to use the Cognito Lambda trigger to do some stuff when new users register (via Facebook) and when user loges in.
I've googled a lot and of course followed Amazon's guide but I couldn't find any examples regarding the "userAttributes" dictionary.
Can someone provide an example for this triggers?
Upvotes: 1
Views: 2882
Reputation: 93
Here are the details of values that are needed for userAttributes
userAttributes This field is required.
It must contain one or more name-value pairs representing user attributes to be stored in the user profile in your user pool. You can include both standard and custom user attributes. Custom attributes require the custom: prefix to distinguish them from standard attributes. For more information see Custom attributes.
Note
In order for users to reset their passwords in the forgot-password flow, they must have either a verified email or a verified phone number. Amazon Cognito sends a message containing a reset password code to the email or phone number in the user attributes.
Attributes Requirement Any attributes marked as required when you created your user pool If any required attributes are missing during the migration, default values will be used. username Required if you have configured your user pool with email and/or preferred_username aliases in addition to username for sign-in, and the user has entered an email or phone number to sign-in.
Otherwise, it is optional and will be used as the username instead of the username entered by the user.
Note
username must be unique in the user pool.
cognito:mfa_enabled Required if MFA is configured as optional in the User Pool. This attribute specifies whether MFA is enabled for the user.
Upvotes: 0
Reputation: 3521
The userAttributes
dictionary contains the available attributes like Name, email, phone number etc. The actual attribute available is determined by the attribute read permissions set for your app client & in case of external providers like Facebook, the attribute mapping defined in the Userpool. As @Kannaiyan said, the best way to learn about these values would be to print them in your lambda.
Upvotes: 1