# Flow for fetching a user's role and permissions

**URL:** <https://community.auth0.com/t/flow-for-fetching-a-users-role-and-permissions/91038>\
**Category:** Get Help\
**Tags:** react\
**Created:** [September 21, 2022, 11:35am UTC](https://community.auth0.com/t/flow-for-fetching-a-users-role-and-permissions/91038 "2022-09-21T11:35:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigpotato](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bigpotato/32/32722_2.png) [@bigpotato](https://community.auth0.com/u/bigpotato)\
**Post date:** [September 21, 2022, 11:35am UTC](https://community.auth0.com/t/flow-for-fetching-a-users-role-and-permissions/91038/1 "2022-09-21T11:35:13Z")

</div>

I’m trying to implement Auth0 in my react app. My react app requires the user’s role and permissions to block access to certain routes. It looks like there is no way to do it using `@auth0/auth0-react`, so I’m assuming I have to go through the Management API, which is supposed to be used on the backend.

Is this the right flow?

1. On the front end, login through auth0. Get an access token back
2. make a `GET /api/permissions` request to my backend api to fetch the users permissions, attaching the access token as the Authorization header
3. My backend API will get the current user ID using the access token and make a request to Auth0’s management API to fetch the role and permissions and return them to the front end
4. the front end uses the returned role and permissions to allow/block access to certain routes

---

<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:** [September 30, 2022, 9:50pm UTC](https://community.auth0.com/t/flow-for-fetching-a-users-role-and-permissions/91038/3 "2022-09-30T21:50:06Z")

</div>

Hello @bigpotato welcome to the community!

Sorry for the delayed response, but wanted to follow up on this one.

This sounds like a perfect use case for Role Based Access Control ([RBAC](https://auth0.com/docs/manage-users/access-control/rbac)). You can “automatically” add these to a user’s access token with [this setting](https://auth0.com/docs/get-started/apis/enable-role-based-access-control-for-apis) on your API configuration.

You can add roles to a user’s ID token (for front end consumption) using an [Action](https://community.auth0.com/t/how-to-add-roles-and-permissions-to-the-id-token-using-actions/84506#h-11-roles-3). Depending on your app’s particular needs, typically you should be able to rely on Roles to make front-end decisions as the permissions claim will exist in access token which is consumed by your API.

> **[What is Role-Based Access Control (RBAC)? - Auth0](https://auth0.com/intro-to-iam/what-is-role-based-access-control-rbac)**
>
> Role Based Access Control or RBAC helps organizations implement authorization strategies. Find out more here as we dive into the key features and examples.

Hope this helps!

---

<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:** [October 14, 2022, 9:50pm UTC](https://community.auth0.com/t/flow-for-fetching-a-users-role-and-permissions/91038/4 "2022-10-14T21:50:44Z")

</div>

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