Hire Lovable Xperts
Migration

How to Export Lovable Auth Users to Your Own Supabase

You can move your auth users — including their hashed passwords — off Lovable Cloud, but not with the same command that moves your tables. Supabase's standard db dump deliberately skips the auth schema, which is why most guides tell you to reset every password. The fix is to dump the auth schema directly with a full-project backup, then restore it into your new project so users keep their existing passwords.

By Hire Lovable Xperts · Last verified: 2026-07-19

Why can't I export my auth users the same way I export my tables?

Because the Supabase CLI's standard db dump intentionally excludes the auth schema. Supabase's own reference states the command "ignores" the auth, storage, and extension-created schemas, so a plain supabase db dump --schema public gives you every table except your users. That single default is why teams wrongly conclude auth data can never move and fall back to a full password reset.

Your public-schema rows (profiles, orders, settings) come across cleanly with the ordinary dump used in a normal Supabase migration. The users themselves — email, identities, and the hashed password each person signs in with — live in the auth schema managed by the GoTrue auth server, and that schema is filtered out unless you ask for it explicitly.

The distinction matters because keeping the hashes means nobody has to reset a password on cutover. Lose them and every user is locked out until they click a reset email — a worse experience and a measurable drop-off.

supabase db dump --schema public will silently omit every user. To move auth users you must dump the auth schema on purpose.

Related: The general Lovable-to-your-own-Supabase migration · What a Supabase edge function is

Do the password hashes actually come across, or do users have to reset?

They come across — if you can reach the source database. GoTrue stores each password as a hash inside the auth schema, and Supabase's documented project-to-project migration dumps the full schema, auth included. Restore that dump into your new project and every user signs in with the same password. The reset campaign is only the fallback for when you cannot get a database connection at all.

This is the single reason to do the export properly rather than the easy way. A reset email to your whole user base costs you activations; a clean auth-schema restore costs your users nothing and they never notice the move.

The trade-off: dumping auth requires a real database connection string with the Postgres password, not just the anon key that ships in your frontend. The rest of this guide is about getting that connection and running the right dump.

Related: Why exported apps lock users out on cutover

What connection string do I need to reach the Lovable-provisioned database?

You need the database connection string with the Postgres password — found under Project Settings, Database in the Supabase dashboard for the project Lovable provisioned. The anon and publishable keys baked into your app cannot dump auth. This is the step where you must genuinely own or claim the underlying Supabase project, because without database-level access there is no way to read the auth schema.

Supabase exposes two connection strings that work for a dump: the session pooler (port 5432, IPv4-friendly) and a direct connection. Copy the exact string from the dashboard rather than hand-building it — the host and username formats differ between the pooler and a direct connection.

A session-pooler string looks like postgresql://postgres.[PROJECT-REF]:[PASSWORD]@aws-0-[region].pooler.supabase.com:5432/postgres. Store it in an env var (export SRC="...") so it never lands in your shell history in plaintext.

The database password is not the same as your service_role or anon key. If Lovable never gave you database credentials, you must claim the Supabase project before any auth export is possible.

Related: Move secrets out of the client bundle

What is the exact command sequence to export the auth users?

Use Supabase's documented backup flow, which captures roles, the full schema (auth included), and data as three files. Run each supabase db dump against the source connection string you exported as SRC. This is the same sequence Supabase publishes for moving a project between Supabase organisations — it is not a Lovable-specific hack, which is why it is safe to run on a live database.

If you only want the users and nothing else, pg_dump the auth schema on its own instead: pg_dump "$SRC" -n auth --no-owner -f auth_only.sql. The -n flag selects a single schema and all its objects, and --no-owner drops ownership statements so the restore does not fail on roles that do not exist in the target.

  1. Install the CLI if you have not already: npm install -g supabase (then supabase --version to confirm).
  2. Export the source connection string once: export SRC="postgresql://postgres.[REF]:[PASSWORD]@aws-0-[region].pooler.supabase.com:5432/postgres".
  3. Dump roles: supabase db dump --db-url "$SRC" -f roles.sql --role-only
  4. Dump the full schema (this is the step that includes auth): supabase db dump --db-url "$SRC" -f schema.sql
  5. Dump the data: supabase db dump --db-url "$SRC" -f data.sql --use-copy --data-only
  6. Sanity-check the schema file actually contains your users: grep -c "auth.users" schema.sql should return a non-zero count before you go further.
Run the dump during a quiet window. supabase db dump reads a consistent snapshot, but exporting during a burst of new sign-ups means the newest users may miss the cut.

How do I restore the auth users into my new Supabase project?

Create the destination project first, grab its connection string, then replay the three dump files in one psql transaction. Order matters: roles, then schema, then data, with replication role set to replica so foreign-key and trigger checks do not reject the auth rows mid-restore. Running it as a single transaction means a failure rolls the whole thing back cleanly rather than leaving half your users imported.

  1. Create a new project at supabase.com and copy its connection string into a second env var: export DST="postgresql://postgres.[NEW-REF]:[PASSWORD]@aws-0-[region].pooler.supabase.com:5432/postgres".
  2. Restore all three files in one command: psql --single-transaction --variable ON_ERROR_STOP=1 --file roles.sql --file schema.sql --command 'SET session_replication_role = replica' --file data.sql --dbname "$DST"
  3. Confirm the users landed: connect with psql "$DST" and run select count(*) from auth.users; — the count must match the source project.
  4. Point your app's env vars (VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY) at the new project.
  5. Test a real login on a throwaway deploy URL with an existing account and its original password — success means the hashes restored correctly.
Test one real user login before cutover. If the login fails, the auth schema did not restore and you are back to a reset campaign — better to learn that on a preview URL than in production.

Which export method should I use, and what if I can't reach the database?

Pick by how much access you have and how much downtime you can absorb. If you hold the database password, the full backup-restore keeps every password. If you only have the auth schema to move, raw pg_dump is leaner. If you cannot get database credentials at all, the password-reset campaign is the honest fallback — slower for users, but the only path without a connection string.

The reset campaign is covered in the main migration guide: trigger it after DNS cutover, not before, so the reset link points at the new app. It works, but it converts a silent, invisible migration into a visible one — which is exactly what the auth-schema dump avoids.

Auth-user export methods compared
MethodKeeps existing passwords?Needs DB connection string?Best when
Full CLI backup-restore (roles + schema + data)YesYesYou are moving the whole project and want zero user disruption
pg_dump -n auth onlyYesYesTables already migrated; you just need the users
Password-reset campaignNo — users set a new passwordNoYou never received database credentials for the Lovable project

Related: Full order of operations for leaving Lovable · Hand the whole migration to an engineer

Frequently asked questions

Why doesn't supabase db dump include my auth users?
By design. The Supabase CLI reference states that db dump ignores the auth, storage, and extension-created schemas. A plain supabase db dump --schema public therefore exports every public table but none of your users. To move auth users you must dump the full schema, or pg_dump the auth schema explicitly.
Can I migrate password hashes so users don't have to reset?
Yes, if you can reach the source database. GoTrue stores passwords as hashes in the auth schema, and Supabase's documented project-to-project backup dumps the full schema including auth. Restore it into the new project and users keep their passwords. A reset campaign is only needed when you cannot get a database connection.
What credentials do I need to export the auth schema?
The database connection string with the Postgres password, from Project Settings → Database in the Supabase dashboard. The anon or publishable key your app ships with cannot read the auth schema. If Lovable never gave you database credentials, you must claim the underlying Supabase project before any auth export is possible.
How do I dump only the auth users and nothing else?
Use pg_dump with a schema filter: pg_dump "$SRC" -n auth --no-owner -f auth_only.sql. The -n flag selects a single schema and all its objects, and --no-owner strips ownership statements so the restore doesn't fail on roles that don't exist in the target project.
What order do I restore the dump files in?
Roles first, then schema, then data — inside one psql transaction with session_replication_role set to replica so triggers and foreign-key checks don't reject the auth rows mid-import. Running it as a single transaction means any failure rolls the whole restore back instead of leaving half your users imported.
How do I confirm the auth export actually worked?
Two checks. Run select count(*) from auth.users; on both projects and confirm the counts match. Then log in on a preview URL with a real existing account and its original password. A successful login proves the hashes restored; a failure means you're back to a reset campaign, which is far cheaper to discover before cutover.
Is it safe to run these dumps against a live database?
Yes. supabase db dump and pg_dump read a consistent snapshot without locking your tables, so live traffic keeps working. The only caveat is timing: users who sign up during the dump may not be captured, so run it in a quiet window or re-dump auth just before cutover.
Should I do this myself or hire someone?
If you have the database password and a simple auth setup, the CLI flow is a one-hour job. It gets risky with OAuth providers, multi-factor rows, or when you can't locate database credentials at all. Our fixed-price migration handles the auth export, verifies logins on a preview URL, and only cuts over once every user is confirmed.

Talk to a senior engineer — not a salesperson.

Book a free 30-minute audit call. We'll diagnose what's wrong and tell you exactly what it costs to fix.

Book a free audit call