# Post Login Action Enterprise Database Group ID Access

**URL:** <https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688>\
**Category:** Get Help\
**Tags:** identity, groups\
**Created:** [January 19, 2022, 10:08pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688 "2022-01-19T22:08:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tadamski](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tadamski/32/34390_2.png) [@tadamski](https://community.auth0.com/u/tadamski)\
**Post date:** [January 19, 2022, 10:08pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688/1 "2022-01-19T22:08:15Z")

</div>

Hi!

I’m attempting to access the groupIds set on a user in a Post-Login action, though I don’t see a way to access these groupIds. I can see the groups have been set on a particular user (see attached screenshot), but not sure how to get to them. These groups are being provided from an external OIDC connection.

 ![Screen Shot 2022-01-19 at 17.04.21](https://global.discourse-cdn.com/auth0/original/3X/9/f/9f20fc8509bb3e0ab6b3f23022f3b1d63bd89583.jpeg)

Thanks for any help you can provide!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 19, 2022, 10:22pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688/3 "2022-01-19T22:22:41Z")

</div>

Hi @tadamski,

Thanks for reaching out to the Auth0 Community!

First, let me preface that some of the functionality in Actions are still in the progress of being implemented.

In this case, it may be worth trying to access the user’s groups attribute by calling `event.user.groups`.

If this does not return the defined values, you could work around it by including the groups as part of the user’s _user\_metadata_ and retrieving the values that way (`event.user.user_metadata.groups`)

If not, there is the option of using Auth0 Rules to get the user’s groups by calling `user.groups`.

Please let me know how this goes for you.

Thank you.

---

<div class="post-metadata">

**Author:** ![tadamski](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tadamski/32/34390_2.png) [@tadamski](https://community.auth0.com/u/tadamski)\
**Post date:** [January 20, 2022, 3:02pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688/4 "2022-01-20T15:02:57Z")

</div>

Hi @rueben.tiow, thanks for the suggestions!

I did try accessing the groups via `event.user.groups`, but I doesn’t look like those are available yet, as you indicated. The action IDE indicates the groups aren’t available (see screenshot below), but if I manually add a `groups` array to the user context during the Action test, it works, but in real life testing, the groups aren’t there.

I will give the Auth0 Rule a try, thanks again!

 ![Screen Shot 2022-01-20 at 08.21.53](https://global.discourse-cdn.com/auth0/original/3X/3/7/37a5887f647d4665a6b850c82342ac8376f4e92c.png)

---

<div class="post-metadata">

**Author:** ![tadamski](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tadamski/32/34390_2.png) [@tadamski](https://community.auth0.com/u/tadamski)\
**Post date:** [January 20, 2022, 4:15pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688/5 "2022-01-20T16:15:35Z")

</div>

As a final follow-up, I ended up using the event.user.user\_metadata.groups within the Action code, but to make that work, I made a small Auth0 rule to populate the user\_metadata.groups first. This allowed me to keep most of the claims logic in the Action.

```javascript
// Auth0 rule - user-metadata-groups
function (user, context, callback) {
  if (!user.user_metadata) {
    user.user_metadata = {};
  }
  user.user_metadata.groups = user.groups;
  return callback(null, user, context);
}

```

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 20, 2022, 10:35pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688/6 "2022-01-20T22:35:25Z")

</div>

Hi @tadamski,

Thank you for your responses.

I’m glad that you managed to make the `event.user.user_metadata.groups` approach work!

Please don’t hesitate to reach out if you have any further questions.

Thanks!

---

<div class="post-metadata">

**Author:** ![emil.enemaerke](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/emil.enemaerke/32/12752_2.png) [@emil.enemaerke](https://community.auth0.com/u/emil.enemaerke)\
**Post date:** [January 26, 2022, 12:46pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688/7 "2022-01-26T12:46:30Z")

</div>

I’m having the same problem.  
@rueben.tiow Is there an estimate on when groups is accessible from Actions?

Testing with a users raw data that contains the ‘groups’ sections makes the data available, but when adding the action to a flow it’s no longer available for the same user.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 26, 2022, 11:19pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688/8 "2022-01-26T23:19:51Z")

</div>

Hi @emil.enemaerke,

> [@emil.enemaerke](#):
>
> Is there an estimate on when groups is accessible from Actions?

I don’t have the exact date, but it will be sometime this year in 2022. We’re in the process of deprecating Rules, and we anticipate all of the features to be available in Actions after that happens.

Please let me know if you have any further questions.

Thank you.

---

<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:** [February 10, 2022, 11:20pm UTC](https://community.auth0.com/t/post-login-action-enterprise-database-group-id-access/76688/9 "2022-02-10T23:20:41Z")

</div>

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