Auth0 Home Blog Docs

How to access group id in rule

id_token
rule
group

#1

I’m using the Auth0 Authorization Extension to implement the concept of “teams” in our app. Currently I’m able to include user groups in the id_token by enabling Groups in the Token Contents section of the authorization extension. The problem is group names are mutable and I would like to include the group id, which is immutable.

To do this I tried making a rule that accessed user.groups, but that was just a list of names. Does anyone have advice on how to get access to the group ids in a rule? Thanks!


#2

In the Authorization Extension, you can enable API access and view sample API calls from the API section to obtain group info (see screenshot attached).

![alt text][1]


#3

Hi @prashant, thanks for the reply. I’d like to access the group IDs without additional API calls. Do you know of a way to do that? I can already access the group names in the id_token so I was hoping I can get the ids as well.


#4

Hello,

I have the same problem. To be able to actually use the group information in the id_token it has to contain the ID of the groups and not the name of the groups. Did you manage to solve this?


#5