Enable SMS Phone Authentication with Firebase
Use this guide when your app lets users sign in with a phone number. Firebase Phone Authentication requires Firebase Console setup and platform verification setup for reliable production behavior.
Quick Answer
Enable Phone as a Firebase Auth provider, add iOS and Android app credentials that match your app identity, configure APNs for iOS production builds, add Android SHA fingerprints, then test with real devices and Firebase test phone numbers before sending real SMS at scale.
1. Enable Phone Auth
- Open Firebase Console.
- Select your Firebase project.
- Go to Authentication > Sign-in method.
- Enable Phone.
- Add test phone numbers for development when possible.
Test numbers are useful because they do not send real SMS and are not rate limited like production phone numbers.
2. Confirm Native Firebase Config Files
Phone auth must use the Firebase app entry that matches your native app:
| Platform | Check |
|---|---|
| iOS | Bundle identifier and GoogleService-Info.plist. |
| Android | Application id and android/app/google-services.json. |
If you changed the bundle identifier or Android application id, update the Firebase app entry and download fresh config files.
3. iOS Setup
For production iOS builds, configure APNs in Firebase:
- Open Firebase Console.
- Go to Project Settings > Cloud Messaging.
- Select the iOS app.
- Upload an APNs authentication key or certificate.
- Confirm Team ID, Key ID, and bundle identifier match Apple Developer.
Also confirm the iOS app has the correct URL schemes and native configuration
generated by your Firebase GoogleService-Info.plist. If the app uses social
login or Google Sign-In in addition to phone auth, the reversed client id must
match the Firebase file.
4. Android Setup
Add SHA fingerprints to the Android app entry in Firebase.
For debug builds on macOS or Linux:
keytool -list -v \
-alias androiddebugkey \
-keystore ~/.android/debug.keystore \
-storepass android \
-keypass android
For debug builds on Windows:
keytool -list -v ^
-alias androiddebugkey ^
-keystore %USERPROFILE%\.android\debug.keystore ^
-storepass android ^
-keypass android
Copy the SHA-1 and SHA-256 fingerprints into Firebase Console > Project Settings > Your Android app > Add fingerprint.
For release builds, use the upload key or app signing key fingerprint from your Google Play signing setup.
5. Rebuild the App
After changing Firebase config files or native credentials:
cd ios
bundle exec pod install
cd ..
yarn ios
# or
yarn android
Verification Checklist
- Phone provider is enabled in Firebase Auth.
- Test phone numbers are configured for development.
- iOS APNs credentials are uploaded for production.
- Android SHA-1 and SHA-256 fingerprints are added.
- Native Firebase config files match the current app id values.
- A test phone number can sign in on a real device.
Troubleshooting
| Problem | Fix |
|---|---|
| SMS never arrives | Use Firebase test numbers first, then check provider limits, country support, and billing/quota. |
| iOS verification fails | Check APNs credentials, bundle id, and GoogleService-Info.plist. |
| Android verification fails | Check SHA fingerprints and google-services.json. |
| Works in debug but not release | Add release signing fingerprints to Firebase. |
| Too many attempts | Wait for Firebase rate limits to reset or use configured test numbers. |