Firebase Phone Number Verification
Firebase Phone Number Verification (Firebase PNV) is a fast and secure method for verifying user phone numbers. Unlike SMS-based verification, which requires users to receive and input a code from a text message, Firebase PNV works with the device hardware and the mobile carrier to allow for verification in a single tap. This method reduces friction for the user, improves reliability (as it does not use SMS messages that can often go undelivered), and eliminates abuse vectors commonly exploited when using SMS.
Key capabilities
Carriers are the source of truth | With Firebase PNV, Google obtains the verified phone number for the SIM directly from the subscriber, telling you what number is on the device running your app right now. SMS OTPs can only tell you if the user has access to the phone number. |
Use standalone or with an identity provider | You can use Firebase PNV on its own as an easy-to-integrate and reliable method of phone number verification, or you can use it as a sign-in method with Firebase Authentication or your own authentication system. |
Automatically use available carriers | For Firebase PNV to work on a given device, the device needs to have a compatible SIM (card or eSIM) using an available carrier. You can use the Firebase PNV SDK to detect compatibility and fall back to another method such as SMS when Firebase PNV is not supported on the device. |
Broad and growing carrier support | Firebase PNV will gradually become available for carriers worldwide. As new carriers become available, you can automatically use them with no binary changes to your app. See Carrier support for a list of the participating carriers. |
How does it work?
When you make a phone number verification request, Firebase PNV:
Checks that the user's device and mobile carrier are supported.
Gets consent from the user to share their phone number with your app.
Works with the mobile carrier assigned to the SIM to obtain the verified phone number.
Returns to your app a signed token containing the verified phone number.
After verifying the signature of this token, your app now has the user's verified phone number. You can also use this token as part of a phone number based sign-in flow, for example using Firebase Authentication or your own authentication backend.
Implementation path
Set up your Firebase project | Enable the Firebase Phone Number Verification API for your Firebase project in the Google Cloud console. | |
Install the SDK and initialize | Install the Firebase PNV SDK for your app's platform. | |
Check for device and carrier compatibility | (Recommended) When a user performs an action that requires phone number verification, first use the Firebase PNV SDK to check that the device and its mobile carrier are compatible with Firebase PNV. If it isn't, initiate an alternative method of phone number verification, such as SMS. | |
Request the verified phone number | Use the Firebase PNV SDK to request the device's verified phone number from the mobile carrier. | |
Verify the response token | In the response from the Firebase PNV service, you get a signed token, which you can send to your app's backend. On the backend, verify the signature of the token. If the signature is valid, then the token contains the device's verified phone number. |
Next steps
- Firebase PNV is a billed service that incurs a cost per verification. See the Pricing page for details.
- See the Get started on Android guide to learn how to use Firebase PNV in an Android app.