amazon-archives/aws-serverless-auth-reference-app

Creating profile right after registration

Closed this issue · 3 comments

I see a profile option in the read and write attributes of cognito.js, any method i can create a profile right registration

Thank you

Hi Rohit-

You actually create your user's profile attributes and push them to a list array in their entirety prior to calling "signUp" to create the user. This is shown in the primary client-side Cognito User Pools SDK at https://github.com/aws/amazon-cognito-identity-js, under "use case 1" and can also be found in our project under app/src/services/account-management.service.ts. Note that you can also go and update any attribute (except for the primary username) after initial user creation, but it's best to set them all up at once upon first sign-in then only adjust them as the user updates them in a "my profile" page or something similar.

Hope this helps.

Justin

@justonian i am trying add profile picture to the user profile, any possible way i can do that during signup?

Hi Rohit- For that, you would want to use an attribute for the image URL as part of the Cognito User Pools profile information (or a separate profile info DynamoDB table). Since you'd ideally store this in S3, it'd be best to first have users sign-up so you then have their unique ID, then use Cognito Federated Identities to assume an IAM role that allows the user restricted access to view and upload profile pictures, but only to the sub-path of the S3 bucket that matches their unique ID prefix. If you check out the video linked from the main page of the project, you can see more examples of this scenario there as this project has a "upload profile picture" component within.

Justin