authjs

Implement authentication and authorization flows with Auth.js for web applications.

6|1|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/RepairYourTech/cfsa-antigravity --skill authjs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: authjs
Source: https://github.com/RepairYourTech/cfsa-antigravity/tree/main/.agent/skill-library/stack/auth/authjs
Command: npx skills add https://github.com/RepairYourTech/cfsa-antigravity --skill authjs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires next-auth@beta, bcryptjs, zod, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a robust and flexible authentication solution for modern web applications, simplifying the implementation of secure sign-in flows, provider integrations, and session management.

Core Features & Use Cases

  • Multi-Provider Authentication: Seamlessly integrate OAuth providers like Google, GitHub, and Discord.
  • Credentials & Magic Links: Support for traditional username/password login and passwordless email magic links.
  • Session Management: Securely manage user sessions using JWT or database strategies.
  • Route Protection: Implement middleware to protect specific application routes based on authentication status and user roles.
  • Use Case: Securely authenticate users in a Next.js application using Google OAuth, protect API routes, and manage user roles for granular access control.

Quick Start

Install Auth.js and configure Google and GitHub providers in your src/auth.ts file.

Frequently Asked Questions about authjs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement OAuth authentication with Google and GitHub in a Next.js app?

Implement OAuth authentication by configuring Google and GitHub providers in your Auth.js setup. This Skill provides the necessary logic to handle multi-provider sign-in flows, allowing users to authenticate seamlessly via their existing social accounts.

Can I use database sessions with Prisma or Drizzle for user management?

Yes, database sessions are fully supported with Prisma and Drizzle adapters. This allows you to persist user sessions and manage user data directly in your database, providing a robust strategy for tracking authenticated users.

What is the best way to protect routes based on user roles in Next.js?

Protect routes by implementing middleware that checks authentication status and user roles. This approach secures specific application routes, ensuring only authorized users can access protected content and API endpoints.

Does Auth.js support both credentials and passwordless magic links?

Yes, Auth.js supports both traditional username/password credentials and passwordless email magic links. This flexibility allows you to offer multiple secure sign-in methods tailored to your application's user experience requirements.

How do I validate user input during the credentials authentication flow?

Validate user input using Zod schema validation integrated within the credentials authentication flow. This ensures submitted login data meets your required formats before processing the sign-in request through bcryptjs.