# Restrict access to React app with RBAC Scopes

**URL:** <https://community.auth0.com/t/restrict-access-to-react-app-with-rbac-scopes/90801>\
**Category:** JWT.io\
**Tags:** jwt, react, auth0\
**Created:** [September 16, 2022, 8:12pm UTC](https://community.auth0.com/t/restrict-access-to-react-app-with-rbac-scopes/90801 "2022-09-16T20:12:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![astaubin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/astaubin/32/33320_2.png) [@astaubin](https://community.auth0.com/u/astaubin)\
**Post date:** [September 16, 2022, 8:12pm UTC](https://community.auth0.com/t/restrict-access-to-react-app-with-rbac-scopes/90801/1 "2022-09-16T20:12:17Z")

</div>

We would like to restrict access to one of our React Applications based on a set of permissions set on a Role in Auth0. We are looking at using RBAC to achieve this and have the permissions working with the correct Scopes being shown in the JWT.

I am currently using auth0-react and this example [auth0-react/EXAMPLES.md at master · auth0/auth0-react · GitHub](https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md#4-create-a-useapi-hook-for-accessing-protected-apis-with-an-access-token) to get a ProtectedRoute that uses `withAuthenticationRequired()`'s claimCheck option.

What is the best way to confirm the users has the expected scopes in their Access JWT?

I am attempting to use [GitHub - auth0/node-jsonwebtoken: JsonWebToken implementation for node.js http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html](https://github.com/auth0/node-jsonwebtoken) to decode the token and look at the scopes. I got concerned when I noticed the age and number of issues on the repo.

Is there a built in way to confirm a user’s access token has the scopes requested with the `Auth0Provider`?  
Is the ClaimCheck in `withAuthenticationRequired()` the method that should be used for this?

---

<div class="post-metadata">

**Author:** ![gerald.czifra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gerald.czifra/32/75301_2.png) [@gerald.czifra](https://community.auth0.com/u/gerald.czifra)\
**Post date:** [January 28, 2025, 7:50pm UTC](https://community.auth0.com/t/restrict-access-to-react-app-with-rbac-scopes/90801/3 "2025-01-28T19:50:37Z")

</div>

Hi @astaubin

Thank you for reaching out!  
You should be able to configure an Action and access the user’s scopes in the Access token with `event.transaction.requested_scopes` of the Event object. For a more extensive list of all properties, you can take a look at this following [documentation](https://auth0.com/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/post-login-event-object).

Have a great one!  
Gerald

---

<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 11, 2025, 7:50pm UTC](https://community.auth0.com/t/restrict-access-to-react-app-with-rbac-scopes/90801/4 "2025-02-11T19:50:59Z")

</div>

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