auth

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

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/ridhijain709/AIPORSCHE --skill auth-ridhijain709
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth
Source: https://github.com/ridhijain709/AIPORSCHE/tree/main/.agents/skills/auth
Command: npx skills add https://github.com/ridhijain709/AIPORSCHE --skill auth-ridhijain709

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding user authentication to a Next.js application 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 - Provider Integration Guides: Step-by-step setup for Clerk (native Vercel Marketplace), Descope, and Auth0, including SDK installation, provider components, and middleware configuration. - Route Protection Patterns: Covers createRouteMatcher, auth.protect(), API route guards, and sign-in/sign-up page setup with environment variables. - Migration & Validation Rules: Detects legacy next-auth v4 patterns, manual JWT handling with jsonwebtoken, hand-rolled Vercel OAuth, and Clerk Core 3 breaking changes, then recommends modern replacements. - Use Case: You are building a Next.js dashboard on Vercel and need login. This Skill walks you through installing Clerk from the Marketplace, wiring clerkMiddleware, and protecting /dashboard routes in minutes. ## Quick Start Ask the assistant to add Clerk authentication with protected dashboard routes to your Next.js app.

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 in ClerkProvider, and add clerkMiddleware to middleware.ts. Use createRouteMatcher with auth.protect() to guard specific routes like /dashboard.

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 flows with a visual builder, while Auth0 fits enterprise SSO, SAML, and multi-tenant requirements.

How do I protect API routes in Next.js middleware?

Call auth() inside your route handler and check the returned userId, returning a 401 response when absent. Alternatively, configure clerkMiddleware with createRouteMatcher to protect /api paths before requests reach handlers.

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 auth() not working synchronously in Clerk?

In Clerk Core 3, auth() is asynchronous and must be awaited: const { userId } = await auth(). The synchronous call pattern and authMiddleware() were removed, so migrate to clerkMiddleware() and await auth.protect().

Should I use jsonwebtoken for session handling in Next.js?

Manual JWT handling with jsonwebtoken is discouraged for application auth. Managed providers like Clerk or Auth.js provide built-in JWT session handling, CSRF protection, and token rotation without custom cryptographic code.