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

15,186

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

Share:
15,186
Skate to Eat
Author by

Skate to Eat

Updated on June 03, 2022

Comments

  • Skate to Eat
    Skate to Eat almost 2 years

    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?

  • 0x6C38
    0x6C38 almost 6 years
    by any chance do you know if a lambda that makes use of that API must have permissions to a cognito pool resource or to an identity pool?
  • Jeff Voss
    Jeff Voss over 5 years
    this api is non-intuitive as the user has to be already created in order to call it, I wonder if a Post confirmation lambda trigger would be better?
  • Travis Delly
    Travis Delly over 4 years
    Post confirmation lambda trigger doesn't run if the user was created via adminCreateUser, therefore using a post confirmation hook would not work. I'm currently using postAuthentication, but my biggest issue is i'm using a SQL Database which means when the instance isn't warm, it may take longer then usually to get my user.