# Having trouble getting roles from claims

**URL:** <https://community.auth0.com/t/having-trouble-getting-roles-from-claims/56703>\
**Category:** Get Help\
**Tags:** authorization\
**Created:** [January 23, 2021, 3:41pm UTC](https://community.auth0.com/t/having-trouble-getting-roles-from-claims/56703 "2021-01-23T15:41:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jackiegleason](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jackiegleason/32/8119_2.png) [@jackiegleason](https://community.auth0.com/u/jackiegleason)\
**Post date:** [January 23, 2021, 3:41pm UTC](https://community.auth0.com/t/having-trouble-getting-roles-from-claims/56703/1 "2021-01-23T15:41:13Z")

</div>

I am working on a Node project and I am having issues getting the roles from the claims. I see the roles assigned to the user in the Authorization extension. I have the following code to check it…

```
app.get(
    "/secure",
    oidc.claimCheck((claims) => {
        console.log(`The roles are ${JSON.stringify(claims.roles)}`)
        return claims.isAdmin || ( claims.roles && claims.roles.includes('editor'));
    }),
    (req, res)=>{
        // TODO: Add a new post
        res.send("Claim worked");
    }
)

```

But I get…

The roles are undefined

What am I missing?

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [January 25, 2021, 3:08pm UTC](https://community.auth0.com/t/having-trouble-getting-roles-from-claims/56703/3 "2021-01-25T15:08:19Z")

</div>

Hi @jackiegleason,

It may help to decode the entire ID Token at [https://jwt.io/](https://jwt.io/) to see the entire token.

Custom claims are namespaced, so if you are following the [example in the docs](https://auth0.com/docs/extensions/authorization-extension/use-rules-with-the-authorization-extension#add-custom-claims-to-the-issued-token), then the roles may be stored in `claims['https://your_app.com/roles']` instead of `claims.roles`

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 9, 2021, 3:08pm UTC](https://community.auth0.com/t/having-trouble-getting-roles-from-claims/56703/4 "2021-02-09T15:08:36Z")

</div>

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