'"Automatic SMS Verification with the SMS Retriever API" vs "Authenticate with Firebase using a Phone Number"
On my andoird app to do Automatic SMS Verification I can use this:
"Automatic SMS Verification with the SMS Retriever API"
https://developers.google.com/identity/sms-retriever/overview
Nice.
But to do Automatic SMS Verification I can also use Firebase:
"Authenticate with Firebase on Android using a Phone Number"
https://firebase.google.com/docs/auth/android/phone-auth
What is difference between this two approaches?
Solution 1:[1]
Malcolm from the Firebase team here. There are many differences between the two! Let me try to point out a couple of the important differences:
- SMS Retriever API - allows you to auto-retrieve a text message. That's it. Doesn't generate a code on your behalf, and doesn't validate that the code. You can define the message contents yourself (with the caveat that it has to include certain fields), but you also have to send the SMS yourself. Free to use.
- Firebase Phone Auth - Handles all of the steps of phone auth for you - generates an SMS code and sends the SMS, reads the text message for the user (when possible), logs the user in and returns you an FirebaseUser. You cannot define the message contents. Free to use up to 10k uses per month.
TL;DR: If you're already sending your own SMS messages, use the SMS Retriever API for better UX. If you want the full validation flow handled for you, use Firebase Auth. I hope that that helps!
Solution 2:[2]
They are different portions of the same service. But they cannot work together.
Incredibly, Firebase SMS Auth cannot be integrated with the SMS Retriever API. To make them work together, Google could simply append the app's verification hash string to the Firebase Auth SMS sent by means of adding this string to the Firebase console, and this would effectively merge both services.
Currently, you either:
- Send the free Firebase Auth SMS and ask the user to manually copy and paste the received verification code, or:
- Send the SMS from a paid provider and auto-retrieve your verification code using the SMS Retriever API
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Malcolm Deck |
Solution 2 | andreszs |