
Nextjs Authentication
Complete Auth.js 5 setup for Next.js App Router, covering OAuth, route protection, and role-based access.
- skills.sh installs
- 4K
- GitHub stars
- 372
- last updated
- Aug 21, 2026
What it does
- Covers the full lifecycle: install, environment setup, auth config, middleware route guards, and sign-in/sign-out flows
- Includes
auth.ts,middleware.ts, and a typed session extension, with GitHub and Google OAuth providers and a credentials sign-in example - Enforces redirects for unauthenticated users on
/dashboard, auth checks before Server Action mutations, and admin-only pages viaunauthorized() - Designed for Next.js 15+ projects using the App Router with Server Components and Server Actions
Install
$ npx -y skills add giuseppe-trisciuoglio/developer-kit --skill nextjs-authentication -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Next.js Authentication
Overview
Provides authentication implementation patterns for Next.js 15+ App Router using Auth.js 5 (NextAuth.js), covering the complete authentication lifecycle from initial setup to production-ready role-based access control implementations.
When to Use
- Setting up Auth.js 5 from scratch or adding OAuth providers
- Implementing protected routes with Middleware
- Handling authentication in Server Components and Server Actions
- Implementing role-based access control (RBAC)
- Creating credential-based or OAuth sign-in/sign-out flows
Instructions
1. Install Dependencies
Install Auth.js v5 (beta) for Next.js App Router:
npm install next-auth@beta
2. Configure Environment Variables
Create .env.local with required variables:
# Required for Auth.js
AUTH_SECRET="your-secret-key-here"
AUTH_URL="http://localhost:3000"
# OAuth Providers (add as needed)
GITHUB_ID="your-github-client-id"
GITHUB_SECRET="your-github-client-secret"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
Generate AUTH_SECRET with:
openssl rand -base64 32
Details
- Repository
- github.com/giuseppe-trisciuoglio/developer-kit
- Categories
- Backend & APIs, Frontend & UI Code
- First seen
- May 16, 2026
More from giuseppe-trisciuoglio/developer-kit
All 95- Spring Boot Actuator4K
- Spring Boot Dependency Injection4K
- Unit Test Parameterized4K
- Unit Test Controller Layer4K
- Unit Test Json Serialization4K
- Spring Boot Saga Pattern3.9K
- Nextjs Data Fetching3.9K
- Spring Data Neo4j3.9K
- Unit Test Security Authorization3.9K
- Nx Monorepo3.9K
- Langchain4j Spring Boot Integration3.9K
- Langchain4j Tool Function Calling Patterns3.9K
- Langchain4j Rag Implementation Patterns3.9K
- Unit Test Scheduled Async3.9K
- Rag3.9K
- Unit Test Utility Methods3.9K
- Qdrant3.9K
- Unit Test Exception Handler3.9K
- Unit Test Mapper Converter3.9K
- Langchain4j Ai Services Patterns3.9K
- Unit Test Caching3.9K
- Unit Test Config Properties3.9K
- Unit Test Application Events3.9K
- Langchain4j Vector Stores Configuration3.9K
Similar to Nextjs Authentication
More Backend & APIs
nextauth-authenticationmindrally/skills1.2K installsSetup guide for NextAuth.js v5 in Next.js covering providers, JWT and database sessions, and route protection.
auth-patternsdavepoon/buildwithclaude183 installsReference guide for authentication in Next.js covering NextAuth.js (Auth.js) setup, middleware-based route protection, and session handling.
better-authgiuseppe-trisciuoglio/developer-kit3.8K installsType-safe Better Auth integration guide for NestJS, Next.js App Router, and Drizzle ORM with PostgreSQL.
nextjs-supabase-authsickn33/agentic-awesome-skills5.8K installsSupabase Auth integration for Next.js App Router covering clients, middleware, OAuth callbacks, and server actions.
authjs-skillsgocallum/nextjs16-agent-skills798 installsAuth.js v5 setup for Next.js covering Google OAuth, credentials login, environment config, and core API use.
clerk-authenticationmindrally/skills720 installsGuidance for Clerk authentication in Next.js covering middleware, hooks, server actions, and route protection.