Auth0 Permission Check with NextJS

I use React + Auth0 + NextJS for server rendering. Currently I do

export const getServerSideProps = withPageAuthRequired({
  getServerSideProps: async (context: GetServerSidePropsContext) => {
    return {} ;// Return needed server side props

As you may already know withPageAuthRequired just checks for authentication not authorization such as, does user have specific roles or not.
How can I check for authorization of a specific user, if user has specific roles or not?

Hi there @ar4891 welcome to the community!

While I’m not super familiar with NextJS, typically roles are added to an Access Token and are utilized that way - The following resources may be of help:

Regarding adding the roles as a custom claim to an Access Token, please see:

Hope this helps!

1 Like