Getting groups for a user using Python SDK


I’m trying to get the groups that a user is a member of using the python SDK. I need to call this API - How can I do this using the python SDK? I wasn’t able to find anything here - Thanks in advance for your help.

You can use the the method Add User To Group By ID:

from okta import UserGroupsClient

groups_client = UserGroupsClient("https://{org}", "API_KEY")
group = groups_client.get_groups(query="UniqueGroupName")[0]

# Add user to group by ID