# Getting the user and groups associated with a user

**URL:** <https://devforum.okta.com/t/getting-the-user-and-groups-associated-with-a-user/21572>\
**Category:** OAuth/OIDC\
**Created:** [August 15, 2022, 7:44pm UTC](https://devforum.okta.com/t/getting-the-user-and-groups-associated-with-a-user/21572 "2022-08-15T19:44:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mia](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mia](https://devforum.okta.com/u/Mia)\
**Post date:** [August 15, 2022, 7:44pm UTC](https://devforum.okta.com/t/getting-the-user-and-groups-associated-with-a-user/21572/1 "2022-08-15T19:44:39Z")

</div>

Hello,

I am new to okta. I was wondering if there is a way to obtain user group details without supplying an API key in the authorization?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [August 16, 2022, 3:56pm UTC](https://devforum.okta.com/t/getting-the-user-and-groups-associated-with-a-user/21572/2 "2022-08-16T15:56:44Z")

</div>

You need to complete some form of authorization to get that information. One option is, as you saw, hitting the /users/$userId/groups endpoint.

Another is, if you are working on an OIDC application, storing that information within the tokens issued to a user, more details in this guide: [Customize tokens returned from Okta with a Groups claim | Okta Developer](https://developer.okta.com/docs/guides/customize-tokens-groups-claim/)

Note that SAML apps also have a similar functionality, but its configuration is different: [How to pass a user’s group membership in a SAML Assertion from Okta? | Okta Help Center](https://support.okta.com/help/s/article/How-to-pass-a-user-s-group-membership-in-a-SAML-Assertion-from-Okta?language=en_US)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 12, 2024, 9:51pm UTC](https://devforum.okta.com/t/getting-the-user-and-groups-associated-with-a-user/21572/3 "2024-02-12T21:51:20Z")

</div>

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