I’ve been working with the React SDK Quickstart guide here: https://auth0.com/docs/quickstart/spa/react. This guide shows you how to create a
PrivateRoute component that directs the user to log in if they aren’t authenticated. It will display the desired component if a user is authenticated.
This is what I’m trying to figure out:
I currently have my Auth0 API returning user roles in the id token. How can I modify my
PrivateRoute to only display a component if they also have the proper role? Can I reuse this
PrivateRoute to render components for multiple roles? Or would I need to create multiple, for example an
Any guidance would be appreciated. Thanks.