Authentication Troubleshooting

Fixes for the errors you're most likely to meet while working on authentication.

This page is part of the Authentication documentation.

403 INVALID_ORIGIN on Every Auth Request

The page's origin isn't SITE_URL. Better Auth only accepts requests from it. pnpm dev serves http://localhost:5173 (the env.example value), pnpm preview sets http://localhost:4173 itself, and e2e sets its own. On another port, set SITE_URL in the shell: SITE_URL=http://localhost:5000 pnpm preview --port 5000.

Passkeys Fail with "We couldn't complete that"

The page isn't on SITE_URL's host. Passkeys belong to that domain, so the browser refuses them anywhere else (ERROR_INVALID_DOMAIN or ERROR_INVALID_RP_ID in the console). Use the URL itself: localhost and 127.0.0.1 count as different sites. A passkey saved on one domain never works on another, so after changing domains users add a new one. See Passkeys.

Signed In, but /dashboard Sends Me Back to Sign-In

The session cookie wasn't stored. With SITE_URL on https, Better Auth sets secure cookies, which browsers drop on plain http. Use the scheme you open the app with.

"Too many attempts" Locally

Locally every request comes from 127.0.0.1 and shares one limit. Wait a minute, or set AUTH_RATE_LIMIT=false in apps/web/.env. See Rate Limits.

No Email Arrives

  • pnpm dev: check Void's dev inbox (the dev server prints its address, http://localhost:5173/__void/inbox?token=…, at startup).
  • pnpm preview / e2e: no email binding; email not sent (INVALID_FROM or BINDING_MISSING) in the log is expected.
  • Deployed: look for email not sent (the send failed) or auth email not queued (it never reached the queue) in the Worker logs. INVALID_FROM means email.from in void.config.ts isn't on a domain set up for Email Sending. UNVERIFIED_DESTINATION means the account can only send to verified addresses: it needs Workers Paid and Email Sending onboarding (pnpm --filter web exec void email setup --platform cloudflare). See Emails.

Sign-In Says "Verify your email first"

The address isn't verified. The form offers to send the link again. Seed users are verified; reseed if you changed one.

E2E Refuses to Start

  • "e2e only runs against a local database": DATABASE_URL in apps/web/.env points elsewhere. E2E writes users with public passwords.
  • "set AUTH_RATE_LIMIT=true": e2e needs the limits on.
  • A seed-user spec fails after you changed that user's password locally: reseed with pnpm db:seed.

The Schema Check Fails in CI

db/auth-schema.ts or the migrations don't match the options. Run pnpm --filter web exec vp run auth:generate, then pnpm --filter web exec void db generate, and commit both. See Adding Plugins.