Authentication for Next.js, done right
Add login, sessions, and route protection to your App Router app in minutes. Authdog handles the cookies, token refresh, and edge checks so you can focus on your product — not your auth plumbing.
Built for the App Router
Everything Next.js apps need
From middleware to Server Components, Authdog fits the Next.js model instead of fighting it.
App Router & RSC
First-class support for Next.js 14+ App Router. Read the session in Server Components, Client Components, and Server Actions with a single API.
Middleware route protection
Guard whole route trees from the edge. Redirect unauthenticated users before a page ever renders — no flash of protected content.
API & Route Handlers
Validate sessions and access tokens inside Route Handlers and API routes so your server endpoints stay protected end to end.
Typed SDK
A fully typed SDK with autocomplete for sessions, claims, and roles. Catch auth mistakes at build time, not in production.
Automatic token refresh
Sessions are refreshed silently using secure, HTTP-only cookies. No token plumbing, no expiry edge cases to handle yourself.
Edge-ready
Runs on the Edge and Node.js runtimes alike. Verify identity close to the user with sub-millisecond session checks.
Server Components, natively
Read the session on the server
Call getSession() anywhere on the server — Server Components, Server Actions, or Route Handlers — and get a typed, verified session. No providers to thread through your tree, no client-side token juggling, no hydration mismatches.
// app/dashboard/page.tsximport { getSession } from "@authdog/nextjs/server"Â export default async function Page() { const session = await getSession()Â return <h1>Welcome, {session.user.name}</h1>}Ship auth, not boilerplate
Authdog's Next.js integration is designed to disappear into your app — secure defaults, server-first sessions, and edge-speed checks out of the box.
From npm install to a protected route
Drop in the middleware, wrap your app, and your routes are guarded — most teams ship login the same afternoon.
Client-side token handling required
Sessions live in secure HTTP-only cookies and are read on the server. There's no token for client JavaScript to leak.
Session check at the edge
Middleware verifies the session before the page renders, so protected content never flashes and unauthorized users never see it.
Add auth to your Next.js app.
Install the SDK, wrap your app, and protect your routes today. Free to start, with secure defaults built in.