Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aws Cognito: How to assign user to a user group when user signs up

I have below user groups in aws cognito. Admin Member Paid member

I want to assign all user to Member user group as default when they sign up on my application so I can assign different IAM role on that user group.

How do I assign user to a user group programmatically?

like image 735
Skate to Eat Avatar asked Mar 25 '17 20:03

Skate to Eat


People also ask

How do I change the attributes of an Amazon Cognito user pool after creation?

Short description. You can't change standard user pool attributes after a user pool is created. Instead, create a new user pool with the attributes that you want to require for user registration. Then, migrate existing users to the new user pool by using an AWS Lambda function as a user migration trigger.

What is the main difference between Cognito user pool and Cognito identity pool?

With a user pool, your app users can sign in through the user pool or federate through a third-party identity provider (IdP). Identity pools are for authorization (access control). You can use identity pools to create unique identities for users and give them access to other AWS services.

What is user sub in Cognito?

When a user is created in Cognito user pools, Cognito generates a sub for each user which is unique throughout the user pool. As such, you can use the sub field as a unique identifier for your users.


1 Answers

I found that I can use adminAddUserToGroup to add user to the specific group you have set on AWS Cognito. http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html#adminAddUserToGroup-property

like image 195
Skate to Eat Avatar answered Oct 19 '22 12:10

Skate to Eat