Sander Korf
  • Portfolio
  • Resume

Sander Korf

Dutch Full Stack AI Engineer helping businesses cut costs through intelligent automation. 13+ years turning expensive manual processes into systems that work 24/7. Based in Amsterdam, available for freelance projects.

Navigation

  • Portfolio
  • Resume

Legal

  • Cookies
  • Privacy Policy
  • Terms and Conditions

Blog

Algolia

  • Algolia InstantSearch INP and object identity
  • Algolia merch by Sanity _type, not title
  • Algolia InstantSearch search key, not admin

Vercel

  • Next.js empty Suspense fallbacks wreck CLS P95
  • Vercel Workflows: skip closed eToro legs

eToro

  • eToro deploy vs rotate: idle cash not rotate
  • eToro search 404: query fields, not ticker
  • eToro v2 opens at-most-once, settlement
  • eToro LLM overlay ±10pp: critic cannot veto

Next.js

  • next-intl useTranslate skip links above fold
  • next-intl owns Klaviyo nl-NL email copy

Firebase & Expo

  • Staging deep links must not hijack production
  • Turn off Worklets Bundle Mode for EAS SHA-1
  • Reclaim Firebase orphan without password wipe

Centra & Klaviyo

  • Centra to Klaviyo tags need a plugin contract

About

  • Full Stack AI Engineer in Amsterdam

© 2026 Sander Korf. All rights reserved

94719489

  • Applied AI
  1. Home
  2. Blog
  3. Reclaim Firebase orphan without password wipe

Reclaim Firebase orphan without password wipe

An existing email in auth is not always a blank account. I send a password reset when one exists and only set a password when none is on file.

Sander KorfPublished August 18, 20262 min read
firebaseexpo

This was a mobile consumer app on Firebase Auth

Expo app. Firebase Auth. Email as the login. Some accounts were created as orphans: an email record with no password provider, leftover from an older import or a half-finished sign-up. If reclaim "fixed" them by writing a new password onto every match, people who already had a password got locked out of their own phone.

What they would notice if it failed

They type the password that worked yesterday. Firebase says invalid. Support says "we migrated you." They did not ask to be migrated. They asked to open the app.

The puzzle: getUserByEmail is not a blank slate

I looked up the email with the Firebase Admin SDK. User exists. I called updateUser({ password }) so they could finish sign-up. That writes a password hash. It does not ask whether they already had one. It does not care that providerData already listed password. It just overwrites.

An orphan is a user whose providerData has no password provider. That is the only time setting a password is reclaim. Everyone else already has a credential. You send a reset link. You do not invent a new secret for them because your form had a password field.

const user = await admin.auth().getUserByEmail(email);
const hasPassword = user.providerData.some((p) => p.providerId === 'password');
 
if (hasPassword) {
	await admin.auth().generatePasswordResetLink(email);
	return { status: 'reset_sent' };
}
 
await admin.auth().updateUser(user.uid, { password: newPassword });
return { status: 'reclaimed' };

Client sign-in stays signInWithEmailAndPassword. The orphan path is admin-only and boring. If getUserByEmail throws auth/user-not-found, create the user. Do not catch that error and updateUser a uid you do not have.

Firebase will let you overwrite a password. That is not permission. That is a footgun with an SDK.


Happy coding!
Sander