# How We Can Get Roles From Profile Object

**URL:** <https://community.auth0.com/t/how-we-can-get-roles-from-profile-object/83572>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [May 17, 2022, 9:33am UTC](https://community.auth0.com/t/how-we-can-get-roles-from-profile-object/83572 "2022-05-17T09:33:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![furkan.gulsoy](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/furkan.gulsoy/32/37371_2.png) [@furkan.gulsoy](https://community.auth0.com/u/furkan.gulsoy)\
**Post date:** [May 17, 2022, 9:33am UTC](https://community.auth0.com/t/how-we-can-get-roles-from-profile-object/83572/1 "2022-05-17T09:33:35Z")

</div>

- Which SDK this is regarding: React SDK
- SDK Version:@auth0/auth0-react"
- Platform Version:1.8.0"  
We can get the user object from useauth0 context.  
But the user object has just permissions. We need to get roles from context.  
How can we get roles?  
It gives like below.  
[customdomain.com/permissions](http://customdomain.com/permissions)": [  
“create”,  
“read”,]  
I need roles.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 17, 2022, 11:49pm UTC](https://community.auth0.com/t/how-we-can-get-roles-from-profile-object/83572/3 "2022-05-17T23:49:21Z")

</div>

Hi there @furkan.gulsoy welcome to the community!

> [@furkan.gulsoy](#):
>
> But the user object has just permissions. We need to get roles from context.

As far as I’m aware the roles aren’t available here.

> [@furkan.gulsoy](#):
>
> How can we get roles?

Typically, roles are included in a user’s ID Token and leveraged that way - Please see the following post for how to add them via a Post Login Action:

> [@Setting a user role in an action will not update the permissions in the access token](https://community.auth0.com/t/setting-a-user-role-in-an-action-will-not-update-the-permissions-in-the-access-token/70867/2):
>
> Hi @kl.auth Welcome to Auth0 Community !!! Don’t use Management API call for this. You can add a custom roles claim in a [post-login action](https://auth0.com/docs/actions/triggers/post-login) like this: /\*\* \* @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…

Hope this helps!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 1, 2022, 11:50pm UTC](https://community.auth0.com/t/how-we-can-get-roles-from-profile-object/83572/4 "2022-06-01T23:50:20Z")

</div>

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