# See the roles of users in the accestoken

**URL:** <https://community.auth0.com/t/see-the-roles-of-users-in-the-accestoken/113173>\
**Category:** JWT.io\
**Tags:** jwt\
**Created:** [August 8, 2023, 6:33pm UTC](https://community.auth0.com/t/see-the-roles-of-users-in-the-accestoken/113173 "2023-08-08T18:33:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![auth0-ikearg](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@auth0-ikearg](https://community.auth0.com/u/auth0-ikearg)\
**Post date:** [August 8, 2023, 6:33pm UTC](https://community.auth0.com/t/see-the-roles-of-users-in-the-accestoken/113173/1 "2023-08-08T18:33:17Z")

</div>

How can I see the roles in my user token when I log into my react application with auth0? Now I have the ESSENTIALS plan.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [August 8, 2023, 10:33pm UTC](https://community.auth0.com/t/see-the-roles-of-users-in-the-accestoken/113173/3 "2023-08-08T22:33:55Z")

</div>

Hi @auth0-ikearg,

Welcome to the Auth0 Community!

If you require getting the user’s role in your access token, you need to use the Management API in a Post-Login Actions to append the user’s role to the Access token.

I recommend checking out our [How can I use the Management API in Actions?](https://community.auth0.com/t/how-can-i-use-the-management-api-in-actions/64947) documentation as a starting point.

Please let me know if you have any questions or need more help with the implementation.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![auth0-ikearg](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@auth0-ikearg](https://community.auth0.com/u/auth0-ikearg)\
**Post date:** [August 11, 2023, 1:51pm UTC](https://community.auth0.com/t/see-the-roles-of-users-in-the-accestoken/113173/4 "2023-08-11T13:51:59Z")

</div>

Thanks for the help!  
In my case i created this rule to add the user role in my token:

```auto
function (user, context, callback) {
  const namespace = 'http://localhost:5173';
  const assignedRoles = (context.authorization || {}).roles;

  let idTokenClaims = context.idToken || {};
  let accessTokenClaims = context.accessToken || {};

  idTokenClaims[`${namespace}/roles`] = assignedRoles;
  accessTokenClaims[`${namespace}/roles`] = assignedRoles;

  context.idToken = idTokenClaims;
  context.accessToken = accessTokenClaims;

  callback(null, user, context);
}

```

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [August 11, 2023, 4:22pm UTC](https://community.auth0.com/t/see-the-roles-of-users-in-the-accestoken/113173/5 "2023-08-11T16:22:49Z")

</div>

Hi @auth0-ikearg,

Thanks for the response.

I’m glad you got it working by using an Auth0 Rule!

However, I will draw your attention to the fact that Auth0 Rules is reaching its end of life in the near future, on November 18, 2024. Because of this, we strongly recommend using Auth0 Actions to avoid any disruptions. You should also see a warning banner on the [Auth0 Dashboard \> Auth0 Pipeline \> Rules](https://manage.auth0.com/#/rules) page mentioning this:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/4/1415110230e0ef8c2662796e9b68b1d8374a2eaf.png)

Thanks,  
Rueben

---

<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:** [August 25, 2023, 4:23pm UTC](https://community.auth0.com/t/see-the-roles-of-users-in-the-accestoken/113173/6 "2023-08-25T16:23:00Z")

</div>

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