# Roles not coming back in User

**URL:** <https://community.auth0.com/t/roles-not-coming-back-in-user/64874>\
**Category:** Get Help\
**Tags:** react\
**Created:** [June 22, 2021, 6:56pm UTC](https://community.auth0.com/t/roles-not-coming-back-in-user/64874 "2021-06-22T18:56:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jodie](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jodie/32/30159_2.png) [@jodie](https://community.auth0.com/u/jodie)\
**Post date:** [June 22, 2021, 6:56pm UTC](https://community.auth0.com/t/roles-not-coming-back-in-user/64874/1 "2021-06-22T18:56:03Z")

</div>

I’m using the latest version of auth0-react

When using…

const { user } = useAuth0();

I see all my user data but Nothing to do with Roles.or Permissions.

I want to be able to create a route that only admins can see.

---

<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:** [June 23, 2021, 1:15pm UTC](https://community.auth0.com/t/roles-not-coming-back-in-user/64874/3 "2021-06-23T13:15:11Z")

</div>

Hi @jodie,

The roles/permissions info will not be included in the ID Token by default. In order to include them, you can add a custom claim in a [post-login action](https://auth0.com/docs/actions/triggers/post-login):

```auto
/**
 * @param {Event} event - Details about the user and the context in which they are logging in.
 * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
 */
exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://my-app.example.com';
  if (event.authorization) {
    api.idToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
    api.accessToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
  }
}

```

> **[Login Flow](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow)**
>
> Learn about the Actions Login Flow and the post-login Action trigger, which is executed after a user logs in and when a Refresh Token is requested.

---

<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:** [July 8, 2021, 1:16pm UTC](https://community.auth0.com/t/roles-not-coming-back-in-user/64874/4 "2021-07-08T13:16:02Z")

</div>

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