AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

neon-auth

Add authentication to a new app. Use for "add auth", "add login", Neon Auth (Managed Better Auth), identity routing, sign-up, sign-in, password reset, email OTP, magic links, organizations, phone OTP, OAuth, OAuth server for MCP or third-party OAuth clients, passkeys, MFA, trusted domains, invalid domain, and @neon/auth. No existing identity: default to Managed Better Auth. Keep working Better Auth, Clerk, Supabase Auth, or another IdP. User asked to migrate from Supabase Auth: Managed Better Auth. A required plugin outside Managed support: self-managed Better Auth on a Neon Function or the existing app host. Also use for auth APIs in @neon/neon-js.

Original source
neondatabase
License
Apache-2.0
Pinned revision
d3da7cb5436edbb2bc8c00747fafd31ddf0644f4

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read neondatabase--neon-auth at revision d3da7cb5436edbb2bc8c00747fafd31ddf0644f4, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 4

references/self-managed.md

Self-managed Better Auth

Use this page only after SKILL.md routed here: a required feature is outside Managed Auth, and the installed Better Auth version documents that flow. If that check fails, keep the current identity.

Keep existing Better Auth

If the app already runs Better Auth, keep that server, its clients, users, and sessions. It works with Lakebase Postgres, Functions, Object Storage, and the AI Gateway. Do not migrate it to Managed Auth unless the user asks.

New self-managed server

Host it on the existing app (Vercel route handlers, or similar) when that host already serves /api/auth. Use a Neon Function when the auth server should sit next to Postgres, for example. Function hosting follows the neon-functions skill (region, claim, neon.ts, neon deploy --env <file>).

Keep Lakebase Postgres as the auth database. Use better-auth and better-auth/client. Fetch upstream docs for the installed version:

  • https://better-auth.com/docs/installation
  • https://better-auth.com/docs/concepts/client
  • https://better-auth.com/docs/concepts/plugins

Do not pass plugins into @neon/auth. Replacing only the client package while Managed Auth is still the backend does not add plugins.

The OAuth provider and MCP OAuth (Cursor, Claude, and similar clients self-authorizing) are supported on Managed Auth: oauth-server.md. They are not a reason to self-manage.

Function JWT verification, CORS, and direct browser calls: neon-functions and https://neon.com/docs/compute/functions/authentication.md.

There is no documented universal import from Managed neon_auth into a self-managed Better Auth schema. Inventory users, credentials, sessions, memberships, and application foreign keys before changing existing state. Agree a cutover plan with the owner. Do not promise drop-in session continuity.