auth

Implements Clerk, Descope, and Auth0 authentication for Next.js applications.

Updated Aug 21, 2025
One-click install
npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill auth-adithiya-s
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth
Source: https://github.com/Adithiya-S/AI-Study-Companion/tree/main/.agents/skills/auth
Command: npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill auth-adithiya-s

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up authentication in Next.js involves choosing between providers, configuring middleware, protecting routes, and keeping up with breaking SDK changes. This Skill provides concrete, current integration guidance for Clerk, Descope, and Auth0 so you avoid deprecated patterns and misconfigured middleware. ## Core Features & Use Cases - Clerk Integration: Covers Vercel Marketplace provisioning, clerkMiddleware setup, route protection with createRouteMatcher, pre-built SignIn/SignUp components, and Core 3 breaking changes like async auth(). - Descope and Auth0 Setup: Provides provider configuration, authMiddleware usage, sign-in flows, and session access patterns for both platforms. - Decision Matrix: Compares providers by use case such as fastest Vercel setup, passwordless flows, enterprise SSO, and pre-built UI components. - Use Case: You need to add login to a Next.js app deployed on Vercel. The Skill walks you through installing Clerk from the Marketplace, configuring middleware, and protecting your dashboard and API routes. ## Quick Start Add user authentication with Clerk to my Next.js app, including middleware protection for the dashboard routes.

Frequently Asked Questions about 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?

Install a provider SDK such as @clerk/nextjs, wrap your root layout with ClerkProvider, and add clerkMiddleware to middleware.ts. Use createRouteMatcher with auth.protect() to guard specific routes like /dashboard and /api.

Clerk vs Auth0 vs Descope for Next.js authentication?

Clerk offers the fastest Vercel setup with native Marketplace integration and pre-built UI components. Descope suits passwordless and social login flows with a visual flow builder. Auth0 fits enterprise SSO, SAML, and multi-tenant requirements.

How do I protect API routes in Next.js with Clerk?

Call auth() inside your route handler and check the returned userId, returning a 401 response when it is null. In Clerk Core 3, auth() is asynchronous, so always use await auth() rather than synchronous access.

Does Clerk work with Vercel deployments?

Yes, Clerk is a native Vercel Marketplace integration. Running vercel integration add clerk auto-provisions CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY environment variables with unified billing.

Why is authMiddleware not working in my Clerk app?

authMiddleware was removed in Clerk Core 3. Migrate to clerkMiddleware from @clerk/nextjs/server, and note that auth(), clerkClient(), and auth.protect() are now all asynchronous. Run npx @clerk/upgrade to apply codemods automatically.