Auth.js · browser URL

OAuthAccountNotLinked

what it looks like
/login?error=OAuthAccountNotLinked

What it means

Someone already has an account with this email, created with a different sign-in method (say, a magic link), and now tries GitHub. For security, Auth.js won't attach the new provider to an existing user who isn't signed in.

Common causes

  • Same email used with email magic link first, GitHub second (or the reverse)
  • Test users left in your dev database

How to fix it

  1. Show a friendly message on your sign-in page: "Sign in the way you did the first time"
  2. Let signed-in users link extra providers from their account page
  3. allowDangerousEmailAccountLinking: true on a provider turns on auto-linking. Only use it if you trust that provider to verify emails
src/app/login/page.tsx
const messages: Record<string, string> = {
  OAuthAccountNotLinked: "That email already has an account. Sign in the way you did the first time.",
  Verification: "That sign-in link expired or was already used. Request a new one.",
};

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

Users who signed up with a magic link get OAuthAccountNotLinked when they try GitHub. Show a clear message for ?error=OAuthAccountNotLinked on my sign-in page. Don't enable allowDangerousEmailAccountLinking unless I confirm.

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