Skip to Content
Docs
Guides

Migrate to Pontive

Move users, password hashes, TOTP, social sign-ins and organizations into Pontive from Auth0, Clerk, Firebase, Supabase, Cognito or NextAuth, dry run first and revertable, then switch your app to pontkit.

A migration has two halves: move the users, with the pontive migrate CLI or the import API, then switch the app from the old provider's SDK to pontkit. Pick your provider:

How a migration works

  • A migration source (msrc_…) names the system users are leaving. Each imported user keeps their id there as a legacy subject, and Firebase's hash parameters live on the source.
  • An import run (uimp_…) holds one migration's options, counters and a record per row. Users are sent in batches of 100, then organizations in batches of 100 with up to 1,000 members.
  • Dry run by default. Every batch plans unless told to apply, and the CLI always dry-runs the whole file before it writes anything.
  • Matching is by the old id, never by email. A row matches an existing user by its legacy subject, else its external_id. A row whose email belongs to a user it did not match fails with identifier_conflict, so an import can never attach a password or identity to an account someone else registered. Re-sending a batch skips what it already created.
  • Organizations come after their users, each with its members, and a new one needs a member with the owner role.
  • A run can be reverted while its records exist (90 days after its last batch).

Nothing is emailed to imported users: no welcome, verification or invitation.

What your users notice

They hadIn Pontive
A password, with its hash exportedThey sign in with the same password. It is re-hashed natively at that first sign-in. If it breaks your password policy they are asked to change it, unless the run allows weak passwords.
A password whose hash was not exportedThey use Forgot password on the sign-in page the first time.
TOTPTheir authenticator app keeps working, when the secret was exported and the run names apps to store it under. Otherwise they enroll again.
Google, GitHub, Apple or a custom OIDC sign-inImported identities sign in directly. Without them, the first sign-in links to the account by verified email.
Microsoft or Entra ID sign-inNot portable: their subject differs per app registration. They link by verified email at the first sign-in.
A session in the old systemThey sign in once more after the cutover.

Linking by email needs auto-link by email on in account linking (on by default), a provider that vouches for the address, and an account whose email is verified.

Before you start

  1. Use a development instance first. Import there, sign in as a few migrated users, then repeat against production.
  2. Create a secret key with the admin role on that instance. Migration sources and credential imports (hashes, TOTP secrets, identities) are open to the instance's owners and admins only, and never to a token acting for a user, so an AI client using the Pontive MCP server can import profiles but never credentials.
  3. Run the CLI with npx. It is the pontive package on npm, version 1.19 or later. It reads the key from the environment, never a flag, and picks the API from the key's region.
export PONTIVE_SECRET_KEY=pontive_sk_test_us_...
npx pontive@latest migrate --help

The commands every guide uses:

CommandDoes
migrate source create --name <name> --type <type>Creates the migration source; prints its msrc_… id.
migrate export <provider> [--out file]Writes users, then organizations, as pontive-users/v1 NDJSON, mode 0600.
migrate import <file> --source msrc_…Creates a run and dry-runs every batch. Add --apply to write after the dry run and a confirmation.
migrate run <provider> --source msrc_…Export and import in one go, with nothing written to disk.
migrate status [uimp_…]A run with its options and counters, or the latest runs.
migrate records uimp_… [--outcome failed] [--kind user|organization]Every record of a run.
migrate revert uimp_… [--apply]What the run created that can be deleted; with --apply, deletes it.

In a coding agent (CLAUDECODE, CURSOR_AGENT, CODEX_SANDBOX, GEMINI_CLI or CI set, or --json) the CLI prints one JSON object and never prompts, so --apply also needs --yes. Read the dry run before giving it.

Import options

A run's options are fixed when it is created, which the first dry run does. Change a flag before anything is applied and the CLI starts a new run; once a batch is applied, a different flag is refused.

Flag
--identity-connection google=app_…:googleImport identities of that type into that app's auth connection (the connection's slug after the colon). Repeatable. Types with no mapping are left out and counted, and those users link by email.
--totp-app app_…Store imported TOTP secrets under that app's issuer. The app must have TOTP on. Repeatable. Without one, TOTP secrets are left out and those users enroll again.
--role-map source_role=pontive_role,…Organization roles. A member holding a role the map does not name is left out and reported as role_not_mapped. Without a map, roles are sent as exported.
--on-existing skip|updateWhat a row matching an existing user does. update writes the profile, metadata and verified flags, and replaces credentials only while the user has not chosen a password in Pontive. Default skip.
--allow-weak-passwordsAn imported password that breaks the password policy is not forced to change at first sign-in.
--no-eventsNo pontive.user.created webhook per imported user. Audit entries are written either way.
--name <name>The run's name.
--delete-afterWith --apply, delete the file and its state once applied.

Roles must exist on the org type before an import names them. Every instance has owner and admin; create others with POST /v1/authz/resource-types/org/roles or the Pontive MCP server.

Reading the report

The dry run and the apply both end with counts for users and organizations (created, updated, skipped, failed), failures grouped by error code with each row's key, the warnings, and how many password users have no hash. The codes you are most likely to see:

CodeMeansFix
identifier_conflictAnother Pontive user has this email, phone or usernameDecide which account wins; the import never merges them.
owners_requiredA new organization has no member with ownerMap a source role to owner with --role-map.
role_not_found, role_not_mappedA role is not an org role, or the map does not name itCreate the role, or add it to the map.
password_hash_invalid, hasher_unsupportedThe hash could not be readFix or remove password_hash in those rows; the users then reset.
totp_unsupportedThe secret is not SHA-1, 6 digits, 30 secondsThose users enroll again.

In a dry run, an organization whose members are users the same import creates is reported as pending users, not failed. import keeps .pontive-import-state.json beside the file, so an interrupted --apply continues from the next batch when run again.

Cut over

  1. Sign in on the development instance as a password user, a TOTP user and a social user.

  2. Import into production with a production secret key (pontive_sk_live_…), the same commands and a production migration source.

  3. Catch late sign-ups. Just before switching, export again to a new file and import it into the same run, so one revert still covers everything; rows already imported are skipped: npx pontive@latest migrate import final.ndjson --run uimp_… --apply.

  4. Deploy the app on pontkit, with the production app's redirect URIs and allowed origins registered in Pontive.

  5. Turn off the old system's emails and sign-ups, so nobody receives two of each.

  6. Webhooks. Every imported user fires pontive.user.created with context.source: "import" and the run's id, unless the run used --no-events. A consumer that sends welcome emails should skip those.

  7. Old ids in your database. By default the exporters set external_id to the old provider's id. If your tables key users by it, put it in the access token with the app's claims template:

    { "legacy_user_id": "{{ user.external_id }}" }
  8. Watch passwords move. npx pontive@latest migrate source get msrc_… shows how many imported passwords still wait for their user's first sign-in.

Revert

npx pontive@latest migrate revert uimp_...          # dry run: what would be deleted, what kept
npx pontive@latest migrate revert uimp_... --apply  # deletes it

Revert deletes, outright so the emails are free for a re-import, the users the run created that have not signed in since, and the organizations it created that have no other members. It keeps and lists users who signed in (signed_in), organizations with other members (has_other_members), the owner of an organization it keeps (owns_organization), and what it may not delete (forbidden). What the run updated is not undone. A reverted run takes no more batches.

Any other system: the file format

pontive-users/v1 is NDJSON: one JSON object per line, users before organizations. A user line is POST /v1/users/import's user object with kind beside its fields, an organization line POST /v1/organizations/import's organization object. The header and summary lines are optional.

{"format":"pontive-users/v1","source_type":"other"}
{"kind":"user","legacy_subject":"42","external_id":"42","email":"jane@acme.com","email_verified":true,"name":"Jane Doe","password_hash":{"hasher":"bcrypt","value":"$2b$10$..."}}
{"kind":"organization","external_id":"acme","name":"Acme Corp","members":[{"legacy_subject":"42","roles":["owner"]}]}

legacy_subject needs a migration source on the run (--source). password (plaintext) and password_hash are exclusive; plaintext is hashed and checked against the policy at import.

hashervalue
bcrypt$2a$, $2b$, $2y$
argon2$argon2id$, $argon2i$
scryptPHC $scrypt$…, or the raw hash with salt and params
firebase_scryptbase64 hash with salt; the parameters on the source
pbkdf2passlib's $pbkdf2…$ forms, PHC, or raw with salt and params
djangopbkdf2_sha256$…, pbkdf2_sha1$…, argon2$…, bcrypt_sha256$…, bcrypt$…
werkzeugpbkdf2:sha256:…, scrypt:…
aspnet_identitybase64 v2 and v3
wordpressphpass $P$, $H$, and $wp$2y$
ldap{SSHA}, {SSHA256}, {SSHA512}, {SHA}
digesthex or base64 MD5 or SHA digest, with salt and params.salt_position

Hashes weaker than OWASP's current minimum (digests, LDAP, phpass, Firebase's scrypt, low-cost bcrypt or PBKDF2) are wrapped in argon2id at import, so no weak hash is stored. HMAC with a key, peppers and crypt(3) $1$, $5$, $6$ are refused with hasher_unsupported.

The API takes the same objects directly; see Migration sources and User imports.

Not covered yet

  • Lazy migration (checking a password against the old system at first sign-in) and session carry-over are not built: users without an exported hash reset, and everyone signs in once more.
  • Users without an email (phone-only) are left out: Pontive requires one.
  • SMS factors and passkeys do not move; users enroll again.
  • Root and resource memberships, groups and pending invitations are not imported.
  • There is no migration page in the dashboard yet: use the CLI or the API.