Auth.js Skills
Auth
Auth.js v5 setup for Next.js -- Google OAuth, Credentials provider, session management, and Edge Runtime support.
Overview
This skill provides a comprehensive reference for implementing authentication in Next.js applications using Auth.js v5 (next-auth@beta). It covers the full auth lifecycle: environment configuration, provider setup (Google OAuth and Credentials), session management with JWT or database strategies, middleware-based route protection, and client/server component integration.
When to Use
- Setting up authentication in a Next.js App Router project
- Configuring Google OAuth or email/password login
- Implementing protected routes with middleware
- Extending session types or adding role-based access control
- Migrating from Auth.js v4 to v5
Key Features
- Universal
auth()export: Single function for authentication across server components, API routes, server actions, and middleware - Multi-provider support: Google OAuth and Credentials provider with bcrypt password hashing and Zod validation
- Edge Runtime compatible: Full support for middleware-based auth checks at the edge
- Session strategies: JWT (default) and database-backed sessions with Prisma adapter
- Type-safe: Module augmentation patterns for extending Session and JWT types
- Complete examples: Sign-in pages, registration API, RBAC helpers, and custom callback configurations
Example Prompts
text
Set up Auth.js v5 with Google OAuth in my Next.js app.
Add email/password authentication with Prisma and bcrypt to my project.
Implement role-based access control using Auth.js middleware.Source
- Skill folder:
skills/authjs-skills/ - Standard: agentskills.io