# Get Groups in NextJS App

**URL:** <https://devforum.okta.com/t/get-groups-in-nextjs-app/31556>\
**Category:** OAuth/OIDC\
**Tags:** nextjs, claims\
**Created:** [December 26, 2024, 9:18am UTC](https://devforum.okta.com/t/get-groups-in-nextjs-app/31556 "2024-12-26T09:18:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saurabh\_B\_LTI](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Saurabh\_B\_LTI](https://devforum.okta.com/u/Saurabh_B_LTI)\
**Post date:** [December 26, 2024, 9:18am UTC](https://devforum.okta.com/t/get-groups-in-nextjs-app/31556/1 "2024-12-26T09:18:24Z")

</div>

Hi Team,

We want to implement groups in our app. Can you please help in implementation of it. Currently in scope i have included groups but i did not get anything. Please help with example for Nextjs app with next-auth.

Thanks!

---

<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:** [January 2, 2025, 4:42pm UTC](https://devforum.okta.com/t/get-groups-in-nextjs-app/31556/2 "2025-01-02T16:42:37Z")

</div>

You mention using the `groups` scopes, but from which authorization server (issuer) is your application requesting tokens?

- if using a custom authorization server (issuer == `https://oktaDomain/oauth2/{authorizationServerId}` [is a groups scope AND claim configured for _that_ authorization server](https://developer.okta.com/docs/guides/customize-tokens-groups-claim/main/#add-a-groups-claim-for-a-custom-authorization-server)?
- if using the Org Authorization Server (issuer == ‘[https://oktaDomain](https://oktaDomain)’) is [the groups claim configured for the target OIDC application](https://developer.okta.com/docs/guides/customize-tokens-groups-claim/main/#add-a-groups-claim-for-the-org-authorization-server)?

---

<div class="post-metadata">

**Author:** ![Saurabh\_B\_LTI](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Saurabh\_B\_LTI](https://devforum.okta.com/u/Saurabh_B_LTI)\
**Post date:** [January 2, 2025, 6:15pm UTC](https://devforum.okta.com/t/get-groups-in-nextjs-app/31556/3 "2025-01-02T18:15:16Z")

</div>

Yes, It is through Organization authentication and want to fetch the groups associated with the user.

---

<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:** [January 2, 2025, 11:07pm UTC](https://devforum.okta.com/t/get-groups-in-nextjs-app/31556/4 "2025-01-02T23:07:09Z")

</div>

How did you configure the groups claim on the Application → Sign On/Authentication tab?

For example, the set-up I have below is broad and is designed to return _all_ groups of which the user is a member within the claim

 ![Screenshot 2025-01-02 at 3.05.53 PM](https://global.discourse-cdn.com/oktadev/original/2X/6/6ec7e82ae8e4a0853be676ea0959270af9e40eb6.png)

---

<div class="post-metadata">

**Author:** ![Saurabh\_B\_LTI](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Saurabh\_B\_LTI](https://devforum.okta.com/u/Saurabh_B_LTI)\
**Post date:** [January 27, 2025, 11:20am UTC](https://devforum.okta.com/t/get-groups-in-nextjs-app/31556/5 "2025-01-27T11:20:31Z")

</div>

Yes, I have given the same permissions.

---

<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:** [January 27, 2025, 4:46pm UTC](https://devforum.okta.com/t/get-groups-in-nextjs-app/31556/6 "2025-01-27T16:46:21Z")

</div>

Have you tried sending the Access Token your application received to the Userinfo endpoint? See [this article](https://support.okta.com/help/s/article/Okta-Groups-or-Attribute-Missing-from-Id-Token?language=en_US) for more information about why this may be necessary

---

<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 26, 2025, 4:47pm UTC](https://devforum.okta.com/t/get-groups-in-nextjs-app/31556/7 "2025-02-26T16:47:00Z")

</div>

Closed on February 26, 2025, 4:47pm UTC

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