adding-auth

Add OAuth authentication and protected routes to Next.js apps with Auth.js.

672|104|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/spencerpauly/awesome-cursor-skills --skill adding-auth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-auth
Source: https://github.com/spencerpauly/awesome-cursor-skills/tree/main/resources/adding-auth
Command: npx skills add https://github.com/spencerpauly/awesome-cursor-skills --skill adding-auth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes the complexity of wiring authentication into a web app by guiding you through login, sign-up, session handling, and route protection with a modern auth framework.

Core Features & Use Cases

  • OAuth Providers: Add sign-in with common identity providers such as GitHub and Google.
  • Session Management: Create secure user sessions for authenticated pages and server actions.
  • Protected Routes: Restrict access to pages or actions unless a valid session exists.
  • Use Case: A Next.js app that needs team logins can use this Skill to set up sign-in, keep users authenticated across visits, and block unauthorised access to private dashboards.

Quick Start

Use this skill to add authentication to a Next.js app with Auth.js, configure your providers, and protect your routes.

Frequently Asked Questions about adding-auth

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

FAQPage Schema
How do I add authentication to a Next.js app?

Adding authentication to a Next.js app involves configuring Auth.js, setting up OAuth providers like GitHub or Google, defining route handlers, and establishing secure persistent user sessions.

What is the best way to set up OAuth login in Next.js?

OAuth login in Next.js is best set up using Auth.js to configure identity providers like GitHub and Google, requiring specific provider environment variables and route handlers to manage sign-in flows.

Does this authentication approach work with both App Router and Pages Router?

Yes, this authentication approach works with both Next.js App Router and Pages Router projects, allowing you to implement session management and protected routes regardless of your chosen routing architecture.

How do I create protected routes in a Next.js application?

Protected routes in Next.js are created by restricting access to pages or server actions unless a valid user session exists, utilizing Auth.js session management to block unauthorized access to private dashboards.

Do I need a database adapter for Next.js session management?

A database adapter is optional for Next.js session management. You can configure persistent user sessions with Auth.js using either a database adapter for storage or default session handling without one.