React Native Firebase手机号认证出现[firebase_auth/missing-client-identifier]错误求助
firebase_auth/missing-client-identifier Error in React Native Firebase Phone Auth I've run into this exact issue before when setting up phone auth with RN Firebase, so let me walk you through the most likely fixes that resolved it for me and other developers:
1. Verify AndroidManifest.xml Configuration
The missing-client-identifier error often ties to reCAPTCHA not being able to launch properly. Make sure your android/app/src/main/AndroidManifest.xml includes these critical entries:
- Add the required internet permission (if missing):
<uses-permission android:name="android.permission.INTERNET" /> - Include the Firebase RecaptchaActivity to handle the challenge flow:
<activity android:name="com.google.firebase.auth.internal.RecaptchaActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:excludeFromRecents="true" />
2. Double-Check SHA Fingerprints & Google Services File
Mismatched or outdated fingerprints are a top culprit here:
- Run this command in your Android project root to get the exact fingerprints for your current build variant (usually
debugfor testing):./gradlew signingReport - Compare the
SHA1andSHA256values with what's listed in your Firebase project's app settings. Even a single character mismatch will break the flow. - Re-download the
google-services.jsonfile from Firebase after updating fingerprints, replace the one inandroid/app/, then clean your build cache to ensure the new config is picked up.
3. Clean & Rebuild Your Project
Cached build artifacts often prevent new configurations from taking effect. Run these steps:
- Navigate to your Android directory:
cd android - Clean the build:
./gradlew clean - Go back to your project root and rebuild the app:
npx react-native run-android
4. Ensure Browser Availability & Dependency Compatibility
- The reCAPTCHA flow relies on a modern system browser (like Chrome) to render the challenge. Test on a device/emulator that has a working browser installed—outdated or missing browsers will cause the flow to fail silently.
- Upgrade your
androidx.browserdependency to a newer stable version (your current1.3.0is outdated):implementation 'androidx.browser:browser:1.6.0'
5. Validate Firebase Auth Settings
- Double-check that Phone Authentication is enabled in your Firebase Console under Authentication > Sign-in method.
- Ensure your Firebase project's OAuth 2.0 client IDs are correctly linked to your app. Adding SHA fingerprints sometimes triggers a client ID refresh, which is why re-downloading
google-services.jsonis critical.
6. Upgrade Firebase BOM Version
Your current BOM version (26.8.0) is quite outdated—Firebase regularly patches authentication flow issues. Upgrade to the latest stable BOM in your app/build.gradle:
implementation platform('com.google.firebase:firebase-bom:32.0.0')
This will automatically pull in compatible versions of all Firebase libraries, including firebase-auth.
If none of these work, double-check your app's Firebase initialization code to ensure there are no custom auth configurations overriding the default reCAPTCHA setup.
内容的提问来源于stack exchange,提问作者mdparthi

