Set GroupIds with CreateUserWithPasswordOptions


I use “CreateUserWithPasswordOptions” to create a new user. But there is not option to set “GroupIds”. I know that “GroupIds” exists in “CreateUserRequest”.

How can I set it ?

Hi @bfakhriloo, unfortunately you can’t set GroupIds with CreateUserWithPasswordOptions. To add a user to group(s) upon creation you have a couple options:

  1. As you already mentioned, you can do this with CreateUserRequest.
  2. If you want a solution with CreateUserWithPasswordOptions, you can create the user with this code snippet here:

and then followup on the user object (in the above snippet - “vader”) and run this code snippet:

I hope that helps!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.