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.
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.
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.
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.
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.
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.