100MB FREEResidential proxiesClaim
NumberOTP

Firebase Phone Auth Test Numbers: Setup, Emulator, CI

Set up Firebase phone auth test numbers, run the Auth emulator in CI with real output, and learn what test numbers miss before you ship SMS sign-in.

NNanami
November 26, 202611 min read

Firebase phone auth test numbers are fictional phone numbers you register in the Firebase console, each with a fixed six-digit code. Signing in with one sends no SMS and uses no quota, so they belong in day-to-day development and CI. They are one of three different things developers call "test numbers", though, and none of them proves a real text reaches a real phone. This guide covers all three, a CI-ready emulator flow with output from a local run, and the one real-number check to do before release. It pairs with our Playwright fixture for SMS OTP sign-up tests if your end-to-end suite runs in a browser.

NumberOTP publishes this article, and we sell real numbers for receiving SMS. Firebase facts below come from Google's documentation, read on 27 November 2026; Firebase is a trademark of Google LLC and this post is not affiliated with Google.

Three kinds of Firebase "test number"

Firebase has three separate testing features for phone sign-in, and most confusion comes from mixing them up. Console test numbers have a fixed code and work against your real project; the Local Emulator Suite generates a fresh code per attempt and never touches your project; Phone Number Verification test tokens belong to a different product with no SMS at all.

FeatureWhere you set it upCodeSMS sent?Best for
Fictional test numbersFirebase console, Phone provider, "Phone numbers for testing"Fixed six digits you chooseNoManual testing, device simulators, CI against a real project
Auth emulator (Local Emulator Suite)firebase emulators:start --only authNew random code each flow, printed to the terminal and readable over RESTNoOffline unit and integration tests, throwaway data
Phone Number Verification (PNV) test tokenSecurity, Phone Verification, Testing tab (Android only)None: a token, valid 7 daysNo, PNV never uses SMSApps using Firebase PNV instead of SMS codes
A real numberYour phone, a spare SIM or a rented numberReal SMS from FirebaseYesOne pre-release check of delivery, region policy and message text

One wording trap: Google's Identity Platform page says test numbers work with "the iOS and Android emulators". That means device simulators, not the Firebase Auth emulator. The Auth emulator documentation says the opposite for its own tool: it does not support test numbers with codes preconfigured in the console.

How to add Firebase phone auth test numbers

You add test numbers in the console under the Phone sign-in provider, up to ten per project. The steps, from the Firebase web phone-auth guide:

  1. Open the Firebase console and go to Security, then Authentication.
  2. On the Sign-in method tab, enable the Phone provider.
  3. Expand Phone numbers for testing.
  4. Enter a fictional number and a six-digit code, for example +1 650-555-3434 and 654321, then add it.

Rules worth knowing before you pick numbers:

  • Fictional only. Google suggests US numbers with a 555 prefix. A number already used by an existing user is rejected.
  • E.164 format. Plus sign, country code, no spaces or leading zero when you pass it from code. Our guide to E.164 formatting mistakes in SMS verification lists the usual breakages.
  • Hard-to-guess codes. Google warns that the ID token for a test number carries the same signature as a real user's. Anyone who knows the number and code can sign in to your project.
  • Ten numbers maximum. Enough for a few CI personas; not enough to give every developer their own.

Using test numbers in automated tests

For automated tests you also disable app verification, so the reCAPTCHA, Play Integrity or APNs step does not block a headless run. With the flag on, only fictional numbers sign in; a real number still fails. Each platform has its own switch:

PlatformSettingNotes from the docs
Web (JS SDK)auth.settings.appVerificationDisabledForTesting = trueSet it before creating the RecaptchaVerifier; the mock reCAPTCHA then resolves on its own
AndroidfirebaseAuthSettings.setAppVerificationDisabledForTesting(true)Also setAutoRetrievedSmsCodeForPhoneNumber() to fake SMS auto-retrieval; debug builds only
iOSAuth.auth().settings.isAppVerificationDisabledForTesting = trueSet before verifyPhoneNumber; no APNs token needed
FlutterConsole test numbers; the Flutter guide does not document the flagThe FlutterFire guide says phone sign-in runs only on real devices and the web

A minimal web test with the modular SDK looks like this. Read the number and code from your CI secrets, not from source:

import { getAuth, RecaptchaVerifier, signInWithPhoneNumber } from 'firebase/auth'

const auth = getAuth()
// test builds only, never in production
auth.settings.appVerificationDisabledForTesting = true

const verifier = new RecaptchaVerifier(auth, 'recaptcha', { size: 'invisible' })
const confirmation = await signInWithPhoneNumber(auth, process.env.TEST_PHONE, verifier)
const { user } = await confirmation.confirm(process.env.TEST_CODE)

Gate the flag behind a build-time variable so a release bundle cannot ship with it. Google's Android guide says the same: keep app verification off only in debug builds and don't hardcode fictional numbers in the published app.

The Auth emulator flow for CI (with a local run)

The Auth emulator is the better choice when tests should run offline and leave no users in your real project. It never sends an SMS: it prints the code to its terminal and exposes it on an emulator-only REST endpoint, so a test can read it and finish sign-in.

A local run on 27 November 2026 (firebase-tools 15.37.0, project demo-otp, no purchase, $0) used plain REST calls, which work from any language or CI image:

# 1. start a phone sign-in for a fictional number
curl -s -X POST "http://127.0.0.1:9099/identitytoolkit.googleapis.com/v1/accounts:sendVerificationCode?key=fake-api-key" \
  -H 'Content-Type: application/json' \
  -d '{"phoneNumber":"+16505553434","recaptchaToken":"ignored"}'
# -> {"sessionInfo":"SknusAkn..."}

# 2. read the code the emulator "sent"
curl -s http://127.0.0.1:9099/emulator/v1/projects/demo-otp/verificationCodes
# -> {"verificationCodes":[{"code":"203228","phoneNumber":"+16505553434","sessionInfo":"SknusAkn..."}]}

# 3. finish sign-in with sessionInfo + code
curl -s -X POST "http://127.0.0.1:9099/identitytoolkit.googleapis.com/v1/accounts:signInWithPhoneNumber?key=fake-api-key" \
  -H 'Content-Type: application/json' \
  -d '{"sessionInfo":"SknusAkn...","code":"203228"}'
# -> {"isNewUser":true,"phoneNumber":"+16505553434","idToken":"eyJhbGciOiJub25l...","expiresIn":"3600"}

What the run showed, beyond the docs:

  • The terminal line read "To verify the phone number +16505553434, use the code 203228."
  • A wrong code (000000) returned HTTP 400 INVALID_CODE, and the right code still worked afterwards.
  • Codes are single-use. After sign-in the entry disappeared from the list; a second flow for the same number produced a different code (357082). Filter by phoneNumber and take the newest entry.
  • The ID token is unsigned (header alg: none), as the emulator docs describe. Only emulators, or the Admin SDK pointed at the emulator, accept it.
  • The JS SDK needs a browser. Calling signInWithPhoneNumber from plain Node (firebase 13.4.0) threw auth/operation-not-supported-in-this-environment. Drive the SDK from a browser runner, or use the REST calls above from Node, Python or a shell step.

The emulator also skips rate limiting and anti-abuse checks, so it can't warn you about the quotas you will hit in production.

What test numbers can't tell you

Neither console test numbers nor the emulator send a message, so neither exercises the parts that fail in production. These are the checks only a real SMS covers:

  • SMS region policy. Firebase's web guide says new projects default to a policy that allows no regions. Test numbers sail past it; your first real user in that country does not.
  • Carrier delivery. Filtering, sender-ID rules and delays happen between Google and the handset. Our guide to OTP codes that never arrive covers the common causes.
  • Quotas and billing. The Firebase Authentication limits page lists verification SMS as Blaze-plan only, 3,000 a day and 900 a minute per project (read 27 November 2026), plus an unquantified per-number limit. Firebase's pricing page bills phone auth per SMS sent.
  • Your message as users see it. Language, app name and auto-fill behaviour only show on a real phone.
  • App verification itself. With the testing flag on, Play Integrity, APNs and reCAPTCHA never run. A broken SHA fingerprint or APNs key only shows up with a real number.

That's why a sensible split is test numbers or the emulator for every commit, and one end-to-end run with a real number before each release or after any change to auth settings. Our broader developer guide to testing SMS OTP flows covers the same split for non-Firebase stacks.

The pre-release real-number check with notp

The release check needs a number that can receive your app's SMS, without using a team member's personal phone. With the notp command-line tool it is a short script: buy a number, hand it to your sign-up, wait for the code, and cancel if nothing arrives.

# brew install numberotp/tap/notp ; NOTP_API_KEY comes from a CI secret
N=$(notp buy ot --country usa --max-price 3 --no-wait --json -y)
ID=$(echo "$N" | jq -r .data.id)
PHONE=+$(echo "$N" | jq -r .data.phoneNumber)

./start-signup.sh "$PHONE"          # your app asks Firebase to text this number

if CODE=$(notp wait "$ID" --timeout 5m -q); then
  ./submit-code.sh "$CODE"
else
  notp cancel "$ID"                 # no SMS: cancel, the cost is refunded
fi

Notes on the script, checked against the CLI help and source on 27 November 2026:

  • ot is the "any other" service, the right choice for your own app. On 27 November 2026, notp prices ot --country usa listed $1.05 for a USA number; current figures are on the live pricing page.
  • --max-price caps what the run may spend, and --no-wait --json returns the number and its ID straight away.
  • notp wait exits 0 with the code, 3 when --timeout passes (the number stays open, hence the cancel), and 2 if the number expired or was cancelled and refunded.
  • Allow the number's country in your Firebase SMS region policy first, or the run fails for the same reason a real user's would.

The script above was not run in this article; only the price lookup was. If you would rather receive the code in a callback than poll, the signed webhook receiver in Node.js walkthrough shows that route.

Why NumberOTP for the real-number run

NumberOTP is built for this step. The CLI and official SDKs for TypeScript, Python, Go and PHP, listed on our developer page, talk to the same API as the website. Numbers come from three independent number pools on our own infrastructure, you pay per number by card or crypto with no subscription, and if no SMS arrives within the activation window (typically 20 minutes) the cost goes back to your wallet automatically, per our refund policy. A number usually works for a given sender, but none is promised for every platform. Use it for your own accounts and follow each platform's terms; some platforms don't allow virtual numbers.

Frequently Asked Questions

How many test phone numbers can I add in Firebase?

Firebase allows up to ten fictional test numbers per project, each with its own fixed six-digit code. They are added under the Phone provider in the Authentication sign-in settings. If you need more test identities, reuse a few numbers across test personas, or run the Auth emulator, which accepts any well-formed number and generates a fresh code for every sign-in attempt.

Do Firebase test phone numbers work with the Firebase Auth emulator?

No. The Local Emulator Suite does not support test numbers with codes preconfigured in the console. Instead it accepts any number, prints a new code to its terminal for each attempt and exposes it on an emulator-only REST endpoint. Console test numbers do work on device simulators, such as the iOS Simulator or an Android emulator, connected to your real project.

Why does my Firebase test phone number fail?

Common causes are a number not written in E.164 format, a code that differs from the one saved in the console, or a number that already belongs to a real user. On the web, the testing flag must be set before you create the reCAPTCHA verifier. Remember that with the flag on, only fictional numbers sign in; real numbers are rejected.

Do Firebase test numbers count toward SMS quota or cost money?

No. Signing in with a fictional test number sends no message, so Google's documentation says it does not use your SMS quota and repeated sign-ins are not throttled. Real verification texts are only available on the pay-as-you-go Blaze plan, are billed per SMS sent, and are capped per project, so keep real-number runs to a few per release.

Is it safe to keep test phone numbers in a production project?

It can be, with care. A test number signs in a normal user whose ID token is signed like any other, so anyone who learns the number and code gets in. Use hard-to-guess codes, store them as secrets, rotate them, consider a custom claim that limits test users, and keep the app-verification testing flag out of release builds.

Ship with one real SMS behind you

Use test numbers or the emulator for every commit, and one real number before each release. Create a NumberOTP account, add an API key as a CI secret, and run the notp check above; if no SMS arrives, the cost comes back to your wallet.

Frequently Asked Questions

How many test phone numbers can I add in Firebase?+

Firebase allows up to ten fictional test numbers per project, each with its own fixed six-digit code. They are added under the Phone provider in the Authentication sign-in settings. If you need more test identities, reuse a few numbers across test personas, or run the Auth emulator, which accepts any well-formed number and generates a fresh code for every sign-in attempt.

Do Firebase test phone numbers work with the Firebase Auth emulator?+

No. The Local Emulator Suite does not support test numbers with codes preconfigured in the console. Instead it accepts any number, prints a new code to its terminal for each attempt and exposes it on an emulator-only REST endpoint. Console test numbers do work on device simulators, such as the iOS Simulator or an Android emulator, connected to your real project.

Why does my Firebase test phone number fail?+

Common causes are a number not written in E.164 format, a code that differs from the one saved in the console, or a number that already belongs to a real user. On the web, the testing flag must be set before you create the reCAPTCHA verifier. Remember that with the flag on, only fictional numbers sign in; real numbers are rejected.

Do Firebase test numbers count toward SMS quota or cost money?+

No. Signing in with a fictional test number sends no message, so Google's documentation says it does not use your SMS quota and repeated sign-ins are not throttled. Real verification texts are only available on the pay-as-you-go Blaze plan, are billed per SMS sent, and are capped per project, so keep real-number runs to a few per release.

Is it safe to keep test phone numbers in a production project?+

It can be, with care. A test number signs in a normal user whose ID token is signed like any other, so anyone who learns the number and code gets in. Use hard-to-guess codes, store them as secrets, rotate them, consider a custom claim that limits test users, and keep the app-verification testing flag out of release builds.

Need a number right now? Get $0.10 in free credits — no card required.

Sign up free →

Written by

N

Nanami

Nanami is a telecom and digital privacy specialist at NumberOTP with over 8 years of experience in SMS verification systems, virtual phone infrastructure, and online identity protection. He covers OTP security, number masking, developer APIs, and privacy-first verification workflows for businesses and developers worldwide.

Get your first OTP number free

$0.10 in credits on signup. No card required. Works for 800+ platforms.

Get started free →