auth0-nextjs

Installation
Summary

Add Auth0 authentication to Next.js apps with session management, protected routes, and middleware.

  • Supports both App Router and Pages Router with automatic OAuth callback handling via /auth/login, /auth/logout, and /auth/callback endpoints
  • Provides server-side session access through auth0.getSession() for Server Components and API routes, plus client-side useUser() hook for client components
  • Requires middleware configuration (middleware.ts for Next.js 15+, or proxy.ts for Next.js 16) to mount authentication routes
  • Includes optional <Auth0Provider> wrapper for server-side user hydration and access token retrieval via auth0.getAccessToken()
SKILL.md

Auth0 Next.js Integration

Add authentication to Next.js applications using @auth0/nextjs-auth0. Supports both App Router and Pages Router.


Prerequisites

  • Next.js 13+ application (App Router or Pages Router)
  • Auth0 account and application configured
  • If you don't have Auth0 set up yet, use the auth0-quickstart skill first

When NOT to Use

  • Client-side only React apps - Use auth0-react for Vite/CRA SPAs
  • React Native mobile apps - Use auth0-react-native for iOS/Android
  • Non-Next.js frameworks - Use framework-specific SDKs (Express, Vue, Angular, etc.)
  • Stateless APIs only - Use JWT validation middleware if you don't need session management
Related skills
Installs
968
GitHub Stars
20
First Seen
Feb 6, 2026