Firebase Phone Authentication短信异常及自定义短信配置求助
Hey there! Let's work through your Firebase Phone Auth problems—you mentioned two key issues: not receiving verification SMS, and when you do get them, your project name doesn't show up. Plus you want to customize the message to %LOGIN_CODE% is your verification code for %APP_NAME%. Let's break this down step by step.
1. Troubleshooting SMS Not Being Received
If verification texts aren't reaching users, here are the most common fixes to check:
- Check Firebase Quota & Restrictions: Head to your Firebase Console's Usage tab to confirm you haven't exceeded your free SMS limit, and that your project hasn't been flagged for unusual activity (which could temporarily block SMS delivery).
- Verify Phone Number Format: Ensure users are entering numbers in international format (e.g.,
+15551234567). Firebase requires the country code prefix—missing this is a top reason for failed SMS delivery. - Device/Carrier Blocking: Ask users to check their spam/junk SMS folders (many default messaging apps filter verification texts). Also, some carriers block automated messages from services like Firebase—suggest switching to a different network (e.g., mobile data instead of Wi-Fi) or testing with another device.
- Confirm Firebase Configuration: Double-check that Phone Authentication is enabled in Authentication > Sign-in method. For Android, ensure you've added the correct SHA-1 and SHA-256 fingerprints in Project Settings. For iOS, verify your APNs certificates are properly set up.
- Test Number Limitations: If you're using Firebase's test phone numbers (like
+16505550100), these won't send real SMS—you'll only see the verification code in your Firebase Console logs or app debug output.
2. Customizing SMS Content & Showing Your App Name
To get the exact message you want, follow these steps:
- Access Custom SMS Template: Go to Authentication > Sign-in method > Phone authentication in your Firebase Console. Look for the "Customize SMS template" option—note that you may need to verify your identity (e.g., with a phone number) or complete a project verification process before accessing this feature.
- Use Valid Placeholders: Firebase requires the
%CODE%placeholder for the verification code (this replaces your%LOGIN_CODE%—you can't rename this placeholder). So your template should be:%CODE% is your verification code for %APP_NAME% - Set Your App Name: The
%APP_NAME%placeholder automatically pulls the project name from your Firebase settings. Go to Project Settings > General and confirm the "Project name" field is set to the name you want to appear in SMS. Firebase will replace%APP_NAME%with this value. - Wait for Approval: Custom SMS templates need to be reviewed by Firebase to comply with carrier regulations. Approval usually takes minutes to a few hours. If your template is rejected, check the error message (Firebase will tell you what needs fixing—e.g., prohibited language).
- Test After Setup: Once approved, clear your app's cache and test the flow again to ensure the customized message appears correctly with your app name.
Final Notes
If you've gone through all these steps and still have issues, check Firebase's Authentication logs (in Authentication > Logs) for specific error messages—these can point you to less obvious problems like invalid token requests or regional restrictions.
内容的提问来源于stack exchange,提问作者Gunvant Murge

