Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 5 min read How-to mediumAdept

A Simple 3-Step Process to Migrate from Supabase Auth to Neon Auth

Supabase Auth users can be moved to Neon Auth (built on Stack Auth) without forcing password resets by exporting bcrypt hashes in Modular Crypt Format and importing them through the Stack Auth REST API. A PL/pgSQL function joins auth.users and auth.identities to export emails and encrypted passwords to CSV. A Node.js script then posts each user to the create-users endpoint with the hash in password_hash, handling UTF-8 BOMs and throttling requests to avoid rate limits. Imported users appear in a read-only neon_auth.users_sync Postgres table that can be joined in application queries.

Assumes: Postgres SQL basicsNode.js scriptingbcrypt password hashing

Related posts

  • Meet the New Neon Auth: Branchable Identity in Your Database

    Neon easyNovice

    Neon Auth has been rebuilt on Better Auth and now stores users, sessions, organizations and auth configuration in a neon_auth schema inside the Neon Postgres database. This replaces the earlier external-provider setup that relied on webhook sync. Because identity lives in the database, auth state clones with every branch, and each branch gets its own isolated auth endpoint co-located with compute. RLS policies can reference the JWT user, and user creation plus role assignment can happen in one transaction. A unified neon-js SDK ties together Auth, the Data API and the database, though Neon Auth does not yet support custom Better Auth plugins or server-side handlers.

  • Handling Auth in a Staging Environment

    Neon mediumAdept

    Neon Auth stores users, sessions and OAuth data in a neon_auth schema inside the Postgres database, so branching the database also branches auth state via copy-on-write. Each branch gets its own auth endpoint, which lets preview and staging environments test role, permission and OAuth changes against a copy of production users without touching production or creating test accounts by hand. Deleting the branch removes all copied users. It is built on Better Auth, used through the @neondatabase/neon-js SDK, and can be provisioned per PR with a GitHub Action that outputs the branch's auth URL.

  • Supabase Auth: Identity Linking, Hooks, and HaveIBeenPwned integration

    Supabase mediumAdept

    Supabase Auth adds four features: manual Identity Linking via linkIdentity()/unlinkIdentity() for OAuth identities, session controls (time-boxed sessions, inactivity timeouts, single session per user on Pro and above), leaked password protection using the HaveIBeenPwned Pwned Passwords API with configurable password requirements, and Auth Hooks. Auth Hooks are Postgres functions that run synchronously at points such as access token generation, MFA verification and password verification, so they can add custom JWT claims or enforce custom security rules. Webhook-based hooks via Standard Webhooks are planned for Q1 2024. The GoTrue fork is also being renamed to Auth, with no breaking changes.

  • supabase-js v2

    Supabase mediumAdept

    supabase-js v2 brings incremental quality-of-life changes over v1. Types are now generated from the database via the CLI and set once on the client. signIn() is split into signInWithPassword() and signInWithOtp(), server-side auth moves to auth.admin, and the auth library is now async to fix a multi-tab token refresh race condition that logged users out. insert/update/upsert no longer return data unless select() is appended, which avoids surprise failures under Row Level Security. Constructor config is scoped per sub-library, each sub-library gets typed errors, Edge Function invocations auto-detect content type, and a new channel() API replaces from().on() for realtime and Postgres change subscriptions. v1 gets security and maintenance patches for three months.

  • Supabase Auth now supports Anonymous Sign-ins

    Supabase mediumAdept

    Supabase Auth adds anonymous sign-ins, letting apps create temporary users who are treated as `authenticated` and persisted in `auth.users` with an `is_anonymous` flag exposed as a JWT claim. Postgres Row Level Security policies can check `auth.jwt() ->> 'is_anonymous'` to restrict features, such as blocking anonymous inserts or limiting reads to recent rows. Anonymous users become permanent by linking an email, phone or OAuth identity while keeping the same user ID, so their data carries over. Until automatic cleanup ships, a SQL delete on `auth.users` can purge anonymous accounts older than 30 days.

The quest for software engineering knowledge.

Look:
Layout: