Auth0 with NextJS problem

Hello All,
I am new to Software engineering and development. I am trying to implement auth0 for out application which is using nextjs for frontend and springboot for backend. I successfully implemented the auth0 login in nextjs. I am using the App route structure, so I had to create a new folder named “pages” to be able to follow the instruction provided in auth0. I am not very confident about this procedure but I got it to work.

I still need to to the following:
1- secure nextjs pages (only authenticated user could access otherwise redirect to login page)
2-secure endpoints in java (spring boot)
4-send secure calls from nextjs to the backend APIs.

I am a little bit lost on how to protect pages in nextjs. I know I need to use “withPageAuthRequired” but looks like it is not working only with Page router not the app router.

I am experiencing a lot of deprecated functions and issues that are related to using App router in nextjs and using ‘org.springframework.boot’ version ‘3.0.6’ in the backend.

Hi @haitham,

Thanks for reaching out to the Auth0 Community!

To secure your web pages, I recommend implementing Role-Based Access Control to leverage scopes (permissions) to grant users access to selective pages.

Our Node.js API Implementation (SPAs + API) documentation covers in more detail how to secure your API endpoints.

I hope this helps!

Please reach out if you need additional clarification or have any questions.


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