Short answer
Build the full number before you call Firebase: a plus sign, the country code, then the number without its national trunk prefix (usually a leading 0). Parse it with a library such as libphonenumber-js rather than a regex. On the server, pass a clean E.164 string, and use null, not an empty string, to clear a number with updateUser.
Why Firebase rejects the number, and the fix
01
The country code or plus sign is missing
“Please enter the phone number in a format that can be parsed into E.164 format.” GitHub, firebase-js-sdk auth error messages
People type their number the way they dial it at home, or type the country code and the trunk 0 together, like +44 07911. Parse the input with the country from a picker and send the E.164 result. Countries differ (Italian landlines keep their 0), which is why a library beats a regex. In Flutter the code is invalid-phone-number, without the auth/ prefix.
import { parsePhoneNumberFromString } from 'libphonenumber-js'; const parsed = parsePhoneNumberFromString(input, 'GB'); if (!parsed || !parsed.isValid()) return showMessage('Check the phone number.'); await signInWithPhoneNumber(auth, parsed.number, recaptchaVerifier); // +44791112345602
The Admin SDK gets an empty or formatted string
“The provided value for the phoneNumber is invalid. It must be a non-empty E.164 standard compliant identifier string.” Firebase, Admin Authentication API errors (auth/invalid-phone-number)
createUser and updateUser want a strict E.164 string. Strip spaces, brackets and dashes first. To remove a phone number with updateUser, pass null, not an empty string.
03
Testing with a made-up number
“They will still go through the same validation as a real user's phone number.” Firebase, Authenticate with Firebase using a phone number (web)
A random test number may not be a valid number for its country. Add fictional test numbers with a fixed code in the Firebase console, such as US 555 numbers like +1 650-555-3434, in the same E.164 form.
04
The wrong value reaches the call
An input that is not wired to state, or a masked field that returns its display format, can pass an empty or partial string. Log the exact value just before the call.
Checked against the vendor’s docs on : Firebase docs: Admin Authentication API errors; Firebase docs: Phone authentication (web); firebase-js-sdk: auth error messages.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.See scope and start
Related: Firebase phone auth invalid-app-credential · Firebase auth/too-many-requests · Firebase auth/invalid-email · Firebase auth/invalid-action-code