What problem does it solve?
Next.js projects require standardized login, logout, protected pages, and middleware hooks but configuring Auth0 sessions across App Router and Pages Router can be error prone without guidance.
Core Features & Use Cases
- Auth0Client provisioning: sets up a reusable Auth0Client instance wired to AUTH0_DOMAIN, AUTH0_CLIENT_ID/SECRET, AUTH0_SECRET, and APP_BASE_URL environment values so APIs and server components can acquire sessions.
- Middleware-driven routes: provides middleware or proxy templates that mount /auth/login, /auth/logout, /auth/callback, and /auth/profile endpoints while matching every non-static path.
- Router support and UI hooks: explains optional Auth0Provider wrapping for App Router layouts or Pages _app along with client-only useUser hooks to render login status and profile components.
- Use Case: any Next.js app that needs to guard pages, API routes, or middleware boundaries can follow this workflow to add Auth0 login flows and user context without reinventing setup steps.
Quick Start
Install @auth0/nextjs-auth0, define the required Auth0 environment secrets, and add the middleware entry point to enable login/logout routes in your Next.js project.