Search code examples
androidfirebase-authenticationsms-verification

"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

  • 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:

    1. 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.
    2. 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!