Auth.js · server log

MissingCSRF

what it looks like
[auth][error] MissingCSRF: CSRF token was missing during an action signin. Read more at https://errors.authjs.dev#missingcsrf

What it means

A sign-in or sign-out POST arrived without Auth.js's CSRF cookie and token. Often it's a hand-rolled fetch to /api/auth/signin instead of the provided helpers.

Common causes

  • fetch('/api/auth/signin/…', { method: 'POST' }) written by hand
  • A form posting to the Auth.js endpoint from another origin

How to fix it

  1. Use signIn() from your auth.ts in a Server Action, or signIn from next-auth/react in a Client Component
  2. Don't call the /api/auth endpoints directly
src/app/login/page.tsx
import { signIn } from "@/auth";

<form action={async () => { "use server"; await signIn("github", { redirectTo: "/dashboard" }); }}>
  <button>Sign in with GitHub</button>
</form>

works with next-auth 5.0.0-beta.32 · @auth/core 0.41.3 · Next.js 16.4.3last verified

Prompt for Cursor or Claude Code

Auth.js logs MissingCSRF. Find any hand-written fetch or form that posts to /api/auth/* and replace it with signIn() from auth.ts in a Server Action.

Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Auth.js error fixer.

next: skip the next one

Skip the setup. The VibeBoot SaaS Starter ships Auth.js v5 already wired (GitHub sign-in, optional email magic links, Prisma adapter), plus Stripe and a database on Next.js 16.4.3. $49, one-time.

14-day money-back guarantee · lifetime updates

$ fixed it? get the next one first

New fixes for what AI agents break, by email.

When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.

Subscribe free