AgentStack
SKILL verified Apache-2.0 Self-run

Integrate Nextjs

skill-thunder-id-skills-integrate-nextjs · by thunder-id

Add ThunderID authentication to a Next.js application using the official @thunderid/nextjs SDK. Use when asked to "integrate ThunderID into Next.js", "add auth to my Next.js app", or "connect ThunderID with Next.js".

No reviews yet
0 installs
6 views
0.0% view→install

Install

$ agentstack add skill-thunder-id-skills-integrate-nextjs

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Integrate Nextjs? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

ThunderID — Next.js Integration

Assumes ThunderID is running at https://localhost:8090. If not, run /setup-thunderid first.

Step 1 — Register an Application

Ask the developer to create an application in ThunderID and share the Client ID and Client Secret before continuing.

Guide them through these steps:

  1. Open https://localhost:8090/console and sign in (default: admin / secret)
  2. Navigate to Applications → New Application
  3. Fill in:
  • Name: their app name (e.g. my-nextjs-app)
  • Type: Web Application
  • Authorized Redirect URL: http://localhost:3000
  1. Click Create and copy the Client ID and Client Secret shown on the next screen

Once they paste both values, use them in all subsequent steps. Do not use placeholders — wait for the real values.

Step 2 — Install

Detect the package manager from lockfiles: pnpm-lock.yamlpnpm add, yarn.lockyarn add, bun.lockbbun add, else npm install.

npm install @thunderid/nextjs

Step 3 — Set Environment Variables

Create .env.local:

NEXT_PUBLIC_THUNDERID_BASE_URL=https://localhost:8090
NEXT_PUBLIC_THUNDERID_CLIENT_ID=
THUNDERID_CLIENT_SECRET=
THUNDERID_SECRET=

Generate THUNDERID_SECRET with openssl rand -base64 32 (at least 32 characters).

Step 4 — Add ThunderIDProvider to Layout

Edit app/layout.tsxThunderIDProvider handles the OAuth callback automatically; no manual callback route needed:

import { ThunderIDProvider } from '@thunderid/nextjs/server'

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    
      
        
          {children}
        
      
    
  )
}

Step 5 — Add Middleware for Route Protection

Create middleware.ts at the project root:

import {
  thunderIDMiddleware,
  createRouteMatcher,
} from '@thunderid/nextjs/middleware'

const isProtectedRoute = createRouteMatcher(['/dashboard(.*)'])

export default thunderIDMiddleware(async (thunderid, request) => {
  if (isProtectedRoute(request)) {
    await thunderid.protectRoute()
  }
})

export const config = {
  matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'],
}

Step 6 — Add Auth UI

import {
  SignedIn,
  SignedOut,
  SignInButton,
  SignOutButton,
  UserDropdown,
} from '@thunderid/nextjs'

export default function Home() {
  return (
    
      Next.js Auth Demo
      
        Sign In
      
      
        
        Sign Out
      
    
  )
}

Step 7 — Run and Verify

npm run dev

Click Sign In — you should be redirected to https://localhost:8090 and returned after login.

Troubleshooting

Certificate error — Visit https://localhost:8090 in your browser and accept the warning once.

invalid_client — Double-check the Client ID and Client Secret in .env.local.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.