How to get user's group_ids during user login

How can i get user_ids during user login, i added group_claim, but i am getting group_names instead of ids, is it possible to get group_ids in id_token or access-token?

Or can i get user’s group_ids in /userinfo endpoint?

You can use getFilteredGroups function to get group ids in the claim. This will give you id of the groups added to the user out of the group id array in the first parameter.

getFilteredGroups({"00g....1d7", "00gf...1d7", ........., "00g...1d7" }, "group.id", 100)

You can either give the list directly in the expression or use static allowlist.

2 Likes

@ram.gandhi Thanks, but everytime a new group is created, we need to manually update this:/ Is there any way to dynamically create this list?

Or can i get user’s group_ids in /userinfo endpoint?

If you are looking for an expression in Okta Expression Language, this seems to be the only option at this time.

As far as updating this expression, you might be able to automate this by using event hooks ( group.application_assignment.* events) and workflows.

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