Firebase.auth().signInWithPhoneNumber执行成功但未收到短信(React环境)
Why You Might Not Be Receiving Firebase SMS Verification Codes (Even When
signInWithPhoneNumber Succeeds) Hey there, let's break down the common issues that could be stopping you from getting those SMS codes, even though your signInWithPhoneNumber call is resolving successfully and logging confirmResult to the console:
- Firebase SMS Quota Limits: If you're on Firebase's free Spark plan, there's a monthly cap on verification SMS messages. Head over to your Firebase Console > Authentication > Usage to check if you've hit that limit. Even if you haven't used up all your quota, throttling for high request volumes can cause unexpected delays.
- Carrier or Number Format Issues: Double-check that your number follows strict E.164 format (e.g.,
+8613xxxxxxxxxfor China,+1555xxxxxxxfor the US). Some carriers block messages from Firebase's shortcodes, especially if you're using a virtual phone number, a newly activated line, or a number from a region with strict anti-spam policies. Try testing with a different carrier's number if you can. - SMS Filtering on Your Device: Don't forget to check your phone's spam/junk SMS folder! Many default messaging apps or third-party security tools automatically filter messages from unknown shortcodes (which Firebase uses for verification).
- Regional Delivery Delays or Restrictions: Firebase's SMS delivery can vary a lot by region. If your phone number is in a country where Firebase has limited carrier partnerships, messages might take way longer than expected—or get stuck entirely. You can verify if your number's region is supported by checking the Firebase Console's Authentication settings.
- Recaptcha/AppVerifier Edge Cases: Even though your promise resolved, there might be a silent issue with the reCAPTCHA verification. For example, if the reCAPTCHA widget wasn't properly rendered on the page, or the user skipped a hidden verification step (like a checkbox challenge), Firebase might still proceed but hold off on sending the SMS. Open your browser's dev tools to check for any reCAPTCHA-related errors in the console.
- Firebase Project Configuration Glitches: Rarely, misconfigurations can cause this. Double-check that:
- Phone number sign-in is enabled in Firebase Console > Authentication > Sign-in method.
- Your web app's API key isn't restricted in a way that blocks SMS verification requests (though your successful
signInWithPhoneNumbercall makes this less likely).
If none of these fix it, try using Firebase's test phone numbers (listed in the Authentication section of the Firebase Console) to rule out carrier-specific issues—those should deliver codes instantly in testing environments.
内容的提问来源于stack exchange,提问作者Taylor Austin
相关产品推荐
相关产品推荐

