# How to access group id in rule

**URL:** <https://community.auth0.com/t/how-to-access-group-id-in-rule/8159>\
**Category:** Get Help\
**Tags:** group, id\_token, rule\
**Created:** [September 12, 2017, 5:51am UTC](https://community.auth0.com/t/how-to-access-group-id-in-rule/8159 "2017-09-12T05:51:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon4](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jon4](https://community.auth0.com/u/jon4)\
**Post date:** [September 12, 2017, 5:51am UTC](https://community.auth0.com/t/how-to-access-group-id-in-rule/8159/1 "2017-09-12T05:51:58Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [September 12, 2017, 9:59am UTC](https://community.auth0.com/t/how-to-access-group-id-in-rule/8159/2 "2017-09-12T09:59:53Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![jon4](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jon4](https://community.auth0.com/u/jon4)\
**Post date:** [September 12, 2017, 9:44pm UTC](https://community.auth0.com/t/how-to-access-group-id-in-rule/8159/3 "2017-09-12T21:44:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![matekb](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/matekb/32/6670_2.png) [@matekb](https://community.auth0.com/u/matekb)\
**Post date:** [November 17, 2017, 2:53am UTC](https://community.auth0.com/t/how-to-access-group-id-in-rule/8159/4 "2017-11-17T02:53:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:56am UTC](https://community.auth0.com/t/how-to-access-group-id-in-rule/8159/5 "2018-03-02T05:56:26Z")

</div>


