TB-002
Bulletin
TB-002Bulletin
Migrating users without a password reset day
Password hashes are portable, and so are TOTP secrets, passkeys and sessions. The order of operations that moved 186,000 users without one reset email.
Mateus RochaEngineer, migrations, Lisbon
- Title
- Technical bulletin
- Doc. no.
- LM-09 / TB-002
- Subject
- Operations
- Issued
- 01 Sep 2026
- Reading
- 4 min
The cheapest way to change auth systems is to email everyone a reset link. It is also the most expensive. In the migrations we have watched, a forced reset loses between 5% and 15% of monthly active users in the first month: people who meant to come back, met a chore, and did not. Almost every migration can avoid it. The password hashes you already have are portable, and so are most of the other credentials.
1.0Hashes move; passwords never do
You do not know your users' passwords, and you do not need to. A password hash is a recipe: algorithm, parameters, salt, output. Any system that can run the same recipe can verify the same password. So the import takes each hash as it is, tagged with how it was made. On the user's next successful sign-in, when the plain password passes through memory for a moment, we verify it the old way and store a new argon2id hash. The old one is deleted. Nobody is asked to do anything.
| Format | Export | Verified as-is | Then |
|---|---|---|---|
| bcrypt | The hash string | Yes | Rehash on sign-in |
| argon2id | The encoded hash | Yes | Kept if parameters are current |
| scrypt (Firebase) | Hash, salt, signer key, rounds, memory cost | Yes | Rehash on sign-in |
| PBKDF2 | Hash, salt, iterations, digest | Yes | Rehash on sign-in |
| Salted SHA-1 / SHA-256 | Hash, salt, how they were joined | Yes | Wrapped at import |
| Unsalted MD5 | Hash | Yes | Wrapped at import |
The last two rows deserve a note. A fast hash is dangerous to keep even for a week, so we wrap it at import: the stored value becomes argon2id(old_hash). Verification computes the old hash from the typed password, then the wrapper. The database is immediately as strong as argon2id makes it, without waiting for people to return.
{ "external_id": "usr_18842", "email": "ines@palletline.io", "email_verified": true, "password_hash": "$2b$12$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy", "totp_secret": "JBSWY3DPEHPK3PXP", "created_at": "2022-03-14T09:21:07Z"}npx latch import users.ndjson --dry-run # validates, writes nothingnpx latch import users.ndjson # about 12,000 users a minute2.0When the hashes cannot be exported
Some hosted providers will not hand over hashes, or will only do so through a support ticket that takes weeks. Then you migrate lazily: users are imported without a password, and the first time each one signs in, Latch asks the old system whether the password is right.
Sign-in The same form as always. The user cannot tell a migration is in progress.
Lookup The user exists, imported by email and external ID, with no credential yet.
Bridge A webhook you host, or the old provider's own sign-in endpoint.
Answer A wrong password is a normal failed sign-in and is rate limited as one.
Capture The password is hashed and stored. The old system is not asked about this user again.
Result A normal session. Typical sign-in is about 300 ms slower, once.
Lazy migration has a long tail. After 30 days, expect 70% to 85% of monthly actives to have come through; the rest are people who sign in rarely. Decide in advance what happens to them when the old system is switched off: a reset email at that point reaches only users who were not going to notice anyway.
3.0Everything that is not a password
- User IDs. Keep yours. Each imported user carries an
external_id, and the SDK can return it as the subject, so no foreign key in your database changes. - Social accounts. Match on the provider's stable subject identifier, not on email. Keep the same OAuth client, because some providers (Apple, Facebook) issue identifiers that are scoped to the client or team; a new client makes every user look new.
- TOTP. The shared secret is a base32 string and imports as-is. Codes from the user's authenticator app keep working.
- Passkeys. A WebAuthn credential is bound to the
rpId, a domain, not to the vendor. Keep the domain, import the credential IDs and public keys, and existing passkeys keep working. - Sessions. Do not sign everyone out. For 30 days, accept the old session cookie and exchange it for a new session on first contact.
4.0The order of operations
Export and dry-run
The dry run reports duplicate emails, malformed records and hash formats it does not recognise. Fix the export, not the data.
Import while the old system still runs
Imports are idempotent on external_id. Run it again the night before to pick up new sign-ups.
Mirror new accounts
Until the switch, a webhook from the old system creates each new user in Latch within seconds.
Switch sign-in
Deploy the new sign-in page. Old sessions are bridged; nobody sees a login screen who did not expect one.
Watch for a week, then retire
Compare daily sign-in success with the week before. Close the bridge after 30 days.
5.0What it looks like in numbers
Palletline moved 186,000 monthly active users from an in-house Passport setup in nine days. The import itself took sixteen minutes. Most of the nine days went on the dry run, which found 412 duplicate emails differing only by case, and on waiting a full week with both systems live before anyone was willing to delete code.
186,000
Users imported
0
Reset emails sent
+0.3 pt
Sign-in success, week after vs before
6.0
Get started
6.0Get started
Read enough. Try the part.
Everything in these bulletins is switched on in the free plan: passkeys, 60-second tokens, organizations and roles, for your first 10,000 monthly active users.
npm install @latch/nextjsIncluded on Free
- Monthly active users
- 10,000
- Passkeys, codes, links
- Included
- Social providers
- 3
- Organizations
- 5 members each
- Card required
- No