# Group claims missing when login from localhost

**URL:** <https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453>\
**Category:** OAuth/OIDC\
**Created:** [May 20, 2020, 8:57pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453 "2020-05-20T20:57:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dusan.plavak](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@dusan.plavak](https://devforum.okta.com/u/dusan.plavak)\
**Post date:** [May 20, 2020, 8:57pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/1 "2020-05-20T20:57:44Z")

</div>

Hi I noticed that for some reason the group claims is missing when I log in from localhost.  
If I login from our deployed website everything is working fine.

I am using okta-react with pkce disabled. Any idea why idtoken is missing the claims?

---

<div class="post-metadata">

**Author:** ![vijet](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/vijet/32/245_2.png) [@vijet](https://devforum.okta.com/u/vijet)\
**Post date:** [May 20, 2020, 11:15pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/2 "2020-05-20T23:15:31Z")

</div>

Hi @dusan.plavak,

Are you using the same authorization server for both localhost and deployed website?  
If so, are you including the `openid` and `groups` scope in your authorization request?

I hope you’ve seen this document which explains this - [https://developer.okta.com/docs/guides/customize-tokens-returned-from-okta/add-groups-claim-org-as/#request-an-id-token-that-contains-the-groups-claim](https://developer.okta.com/docs/guides/customize-tokens-returned-from-okta/add-groups-claim-org-as/#request-an-id-token-that-contains-the-groups-claim)

---

<div class="post-metadata">

**Author:** ![dusan.plavak](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@dusan.plavak](https://devforum.okta.com/u/dusan.plavak)\
**Post date:** [May 21, 2020, 5:13pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/3 "2020-05-21T17:13:55Z")

</div>

Hi yop, everything is same, the only change is dns name from which the app is served and redirect uri (because of dns name change)

So in both cases I am using exactly same code, but it behaves differently.

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [May 22, 2020, 6:18am UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/4 "2020-05-22T06:18:17Z")

</div>

Hi @dusan.plavak

Can you please confirm the issuers that are set for both production and localhost environments? Also, is the callback URL for localhost added in the OIDC application’s settings in Okta under General \>\> Login Redirect URIs?

---

<div class="post-metadata">

**Author:** ![dusan.plavak](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@dusan.plavak](https://devforum.okta.com/u/dusan.plavak)\
**Post date:** [May 22, 2020, 8:14am UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/5 "2020-05-22T08:14:40Z")

</div>

I can confirm that issuer is same for both envs and login redirect Uris contains localhost (I checked that, but I would get 400 anyway if it was not there)

---

<div class="post-metadata">

**Author:** ![dusan.plavak](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@dusan.plavak](https://devforum.okta.com/u/dusan.plavak)\
**Post date:** [May 22, 2020, 10:17am UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/6 "2020-05-22T10:17:50Z")

</div>

@dragos also note I am specifying group claims in Sign On tab, in section OpenID Connect ID Token, so it is not under authorization server

---

<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:** [May 22, 2020, 4:06pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/7 "2020-05-22T16:06:44Z")

</div>

@dusan.plavak It sounds like you might be running into expected behavior, regarding ‘thin’ ID tokens (where if you request both an ID and an Access token in the same request, the ID token will not contain the full list of claims). If this is the case, as long as you include the ‘groups’ scope in your request, you should still see the groups claim in the output from the /userinfo endpoint.

Can you try sending your access token to /userinfo to see if this is what’s happening?

More info about what I’ve described here: [https://support.okta.com/help/s/article/Okta-Groups-or-Attribute-Missing-from-Id-Token](https://support.okta.com/help/s/article/Okta-Groups-or-Attribute-Missing-from-Id-Token)

---

<div class="post-metadata">

**Author:** ![dusan.plavak](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@dusan.plavak](https://devforum.okta.com/u/dusan.plavak)\
**Post date:** [May 25, 2020, 1:13pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/8 "2020-05-25T13:13:20Z")

</div>

Hi does it also explain that this behaviour is kid of random? Sometimes it return group claims and sometimes not

---

<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:** [May 26, 2020, 3:56pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/9 "2020-05-26T15:56:56Z")

</div>

Does it differ based on the user? If the Groups claim filter/expression you have created does not result in any matches for the user logging in, their token will not contain the ‘groups’ claim (same as with any other attribute that may be getting pulled into a claim).

---

<div class="post-metadata">

**Author:** ![dusan.plavak](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@dusan.plavak](https://devforum.okta.com/u/dusan.plavak)\
**Post date:** [May 26, 2020, 4:26pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/10 "2020-05-26T16:26:20Z")

</div>

Nope, same user. ☹

For now we just dropped token from response type and kept only id\_token… I guess we are not going to investigate it anymore for now, as the behaviour seems to be random and we do not have exact steps on how to reproduce it

---

<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:** [January 24, 2024, 7:51pm UTC](https://devforum.okta.com/t/group-claims-missing-when-login-from-localhost/9453/11 "2024-01-24T19:51:20Z")

</div>

Closed on January 24, 2024, 7:51pm UTC

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