3

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?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Alexei
  • 14,350
  • 37
  • 121
  • 240

2 Answers2

5

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!

Malcolm Deck
  • 376
  • 2
  • 6
  • 2
    `reads the text message for the user (when possible)` . What are the cases when its possible and when its not ? – Manohar Dec 10 '20 at 06:46
  • There are some devices where the auto fill is not enabled or available and these are the devices mostly which doesn't support the auto retrieval. – CodeRED Innovations Jan 29 '21 at 14:02
  • Malcom, is there any possibilty of Google merging both services? That is, to **append the SMS Retriever API verification hash string to the SMS sent by Firebase Phone Auth**. This way, the Firebase SMS could be auto retrieved to ease the process for the user. – andreszs Apr 24 '22 at 18:02
  • Firebase Auth does this for you now: https://firebase.google.com/docs/auth/android/phone-auth#verification-callbacks – Malcolm Deck May 09 '23 at 21:25
0

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:

  1. Send the free Firebase Auth SMS and ask the user to manually copy and paste the received verification code, or:
  2. Send the SMS from a paid provider and auto-retrieve your verification code using the SMS Retriever API
andreszs
  • 2,896
  • 3
  • 26
  • 34