[keycloak-user] Adding users to groups using restapi

Marko Strukelj mstrukel at redhat.com
Mon Nov 6 12:05:55 EST 2017


I think you should use
/auth/admin/realms/MY_REALM/users/USER_ID/groups/GROUP_ID.

And your JSON should contain:
{"realm": "My_realm", "userId":USER_ID, "groupId":GROUP_ID}




On Mon, Nov 6, 2017 at 1:37 PM, O'Callaghan, John <
john.ocallaghan at accenture.com> wrote:

>
>
> Hi All
>
> Im trying to use the rest api to update an existing user to add them to an
> existing group.
> The url that I am using is /auth/admin/realms/MY_REALM/users/USER_ID
>
> Where MY_REALM is equal to my realm name and
> USER_ID is equal to an existing users id.
>
> I am sending a json doc in the PUT body and in here I have { “groups”:
> [“admin”], “enabled”: True }
>
> But when I look at the users info using the WebUI I am not seeing the
> admin group listed in their “Group Membership” table. I do see it listed in
> their “Available Groups” table.
>
> I do see that the users “enabled” flag is going from False to True after
> the PUT so I believe the permission to update the user is correct. But
> shouldn’t I see the admin group added to the Group Membership table too?
>
> Has anyone come across this problem?
> Any help would be really appreciated.
> Thanks
> John
>
>
>
> ________________________________
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise confidential information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the e-mail by you is prohibited. Where allowed
> by local law, electronic communications with Accenture and its affiliates,
> including e-mail and instant messaging (including content), may be scanned
> by our systems for the purposes of information security and assessment of
> internal compliance with Accenture policy.
> ____________________________________________________________
> __________________________
>
> www.accenture.com
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user


More information about the keycloak-user mailing list