# Access to custom attributes (or roles) without use of API token within OpenID session

**URL:** <https://devforum.okta.com/t/access-to-custom-attributes-or-roles-without-use-of-api-token-within-openid-session/23062>\
**Category:** OAuth/OIDC\
**Created:** [January 17, 2023, 5:19am UTC](https://devforum.okta.com/t/access-to-custom-attributes-or-roles-without-use-of-api-token-within-openid-session/23062 "2023-01-17T05:19:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbie-okta](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@newbie-okta](https://devforum.okta.com/u/newbie-okta)\
**Post date:** [January 17, 2023, 5:19am UTC](https://devforum.okta.com/t/access-to-custom-attributes-or-roles-without-use-of-api-token-within-openid-session/23062/1 "2023-01-17T05:19:54Z")

</div>

hi all,

I apologise in advance if this question is from my ignorance of how Okta works. (as I’ve only recently started working with it)

Presently I’m using the OpenIdConnect call to establish an Okta session.  
And this allows vision on these attributes (via the /userInfo call, when the session is established)

> **[OpenID Connect & OAuth 2.0 API | Okta Developer](https://developer.okta.com/docs/reference/api/oidc/#userinfo)**
>
> Find information about the OAuth 2.0 and OpenID Connect endpoints that Okta exposes on its authorization servers.

eg:  
{  
“sub”: “xxxxxxxxxxxxxxxxxxxxx”,  
“name”: “John Smith”,  
“locale”: “AU”,  
“preferred\_username”: “[john.smith@nowhere.com](mailto:john.smith@nowhere.com)”,  
“given\_name”: “John”,  
“family\_name”: “Smith”,  
“zoneinfo”: “America/Los\_Angeles”,  
“updated\_at”: 1667464743  
}

To retrieve the roles of a specific user, this API call was used: /api/v1/users/[userID]/groups ([Users | Okta Developer](https://developer.okta.com/docs/reference/api/users/#get-user-s-groups)), which worked fine during testing on UAT.

But our client isn’t keen on providing an API token to their database.  
However the users role needs to be known for implementing tiered access functionality to the website for each Okta session.

Our client claims it should be possible to retrieve this via querying attributes, but how are Okta session attributes accessed? (outside of those listed above) Is their another call somewhere that does this? (without the need of an API token)

If this just isn’t possible without an API token, that would be good to know, at least then I can go back to the client with a specific request: please give me API access.

I’m attempting to do this in C#.

Thanks for you time.

---

<div class="post-metadata">

**Author:** ![sigama](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sigama/32/5811_2.png) [@sigama](https://devforum.okta.com/u/sigama)\
**Post date:** [January 17, 2023, 5:42pm UTC](https://devforum.okta.com/t/access-to-custom-attributes-or-roles-without-use-of-api-token-within-openid-session/23062/2 "2023-01-17T17:42:09Z")

</div>

Hi @newbie-okta, if I understand correctly you want group information? If so you can add a group scope to your /token or /userinfo call.

---

<div class="post-metadata">

**Author:** ![newbie-okta](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@newbie-okta](https://devforum.okta.com/u/newbie-okta)\
**Post date:** [January 17, 2023, 11:46pm UTC](https://devforum.okta.com/t/access-to-custom-attributes-or-roles-without-use-of-api-token-within-openid-session/23062/3 "2023-01-17T23:46:35Z")

</div>

Thanks for you response Sigama.

When I try making a separate call with groups included on to the url.  
ie: /v1/userinfo/groups

Okta returns “method not allowed”.

I also tried adding groups to the scopes list:  
“openid profile groups” (where before it was just “openid profile”, & based on the doco I’ve assumed it’s groups and not group)  
Which errors:  
‘invalid\_scope’. Error\_Description (may be empty): ‘One or more scopes are not configured for the authorization server resource’

I think I’m getting closer and will continue with this trial and error approach, I appreciate your help.

regards,

---

<div class="post-metadata">

**Author:** ![sigama](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sigama/32/5811_2.png) [@sigama](https://devforum.okta.com/u/sigama)\
**Post date:** [January 19, 2023, 5:35pm UTC](https://devforum.okta.com/t/access-to-custom-attributes-or-roles-without-use-of-api-token-within-openid-session/23062/4 "2023-01-19T17:35:51Z")

</div>

Hey @newbie-okta happy to help!

Two things:

1. Are you using a custom authorization server? I explain the difference here - [Okta Authorization Servers for OpenID Connect and OAuth 2.0 Integrations - YouTube](https://www.youtube.com/watch?v=PASiA_2ChFU&t=101s)

2. Did you configure a group claim within that authz server? - [Okta Help Center (Lightning)](https://support.okta.com/help/s/article/Can-we-retrieve-both-Active-Directory-and-Okta-groups-in-OpenID-Connect-claims?language=en_US)

I explain common issues here - [Okta Authorization Servers for OpenID Connect and OAuth 2.0 Integrations - YouTube](https://www.youtube.com/watch?v=PASiA_2ChFU&t=443s)

---

<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:** [February 13, 2024, 7:50pm UTC](https://devforum.okta.com/t/access-to-custom-attributes-or-roles-without-use-of-api-token-within-openid-session/23062/5 "2024-02-13T19:50:18Z")

</div>

Closed on February 13, 2024, 7:50pm UTC


