I am attempting to implement Auth0 for our application, which utilizes Next.js for the frontend and Spring Boot for the backend. I’ve successfully implemented Auth0 login in Next.js using the App route structure, which required me to create a new folder named “pages” to comply with the instructions provided by Auth0. Although I am not entirely confident about this process, I managed to get it working.
However, I still need to address the following tasks:
Secure Next.js pages (only authenticated users should be able to access these, others should be redirected to the login page).
Secure endpoints in Java (Spring Boot).
Send secure calls from Next.js to the backend APIs.
I’m a little lost on how to protect pages in Next.js. I understand that I need to use “withPageAuthRequired”, but it appears to work only with Page router, not the App router.
Furthermore, I am encountering numerous deprecated functions and issues related to using the App router in Next.js and ‘org.springframework.boot’ version ‘3.0.6’ in the backend.