Phone number based authentication in Admin SDK

2,355 views
Skip to first unread message

Varun Gupta

unread,
Jun 14, 2017, 9:55:21 AM6/14/17
to Firebase Google Group
Hi Firebase Team,

Are there any plans to provide phone number based authentication in the Admin SDK? On the documentation, I see that it is only provided in the client side SDK (Web, iOS, Android). I am currently using a third party service to perform phone number based authentication using cloud functions and custom authentication tokens and I wanted to shift to the phone number based authentication provided by Firebase but still as part of the cloud functions.

Thanks,
Varun

Frank van Puffelen

unread,
Jun 14, 2017, 10:37:22 AM6/14/17
to Firebase Google Group
Similar question (unanswered for now, just linking them for future reference): https://stackoverflow.com/q/44547671

Hiranya Jayathilaka

unread,
Jun 14, 2017, 1:24:40 PM6/14/17
to fireba...@googlegroups.com
Hi Varun,

Yes, we intend to implement some support for phone number auth in the Admin SDK. To start with we are going to address the following issues:


However, if you're looking for a method like signInWithPhoneNumber(), I don't think we will add it to the Admin SDK directly. In general we don't provide end user authentication methods in the Admin SDK. But perhaps a method to verify a user's phone number can benefit the Admin SDK. Can you explain your existing event flow with Cloud Functions so we can better understand your requirement?

Thanks,
Hiranya


--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/43e7b37a-f7ec-4193-9dd3-64b472e021de%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Hiranya Jayathilaka | Software Engineer | h...@google.com | 650-203-0128

Varun Gupta

unread,
Jun 15, 2017, 10:32:12 AM6/15/17
to Firebase Google Group
Hi Hiranya,

I only intend to use it to verify user's phone number first time they install the app after which I assign the user a unique ID (Firebase ID for the user record) and use that to authenticate user using custom authentication. My current workflow is:

1. User installs the app
2. User is asked to register using their phone number
3. User enter their phone number
4. I invoke a cloud function that will invoke a third party service (currently Nexmo) to send a verification code to the user phone via text message
5. User transition to the next screen on the app where he needs to enter the verification code
6. User enters the verification code
7. I invoke another cloud function that will invoke the third party API to verify the code
8. On successful verification, I create a new user record on Firebase and send the user ID back to the app
9. Then onwards when user opens the app again, I verify the user using the unique user ID assigned by Firebase.

I only intend to use Firebase phone based authentication to replace the third party service calls.

Thanks,
Varun

On Wednesday, 14 June 2017 22:54:40 UTC+5:30, Hiranya Jayathilaka wrote:
Hi Varun,

Yes, we intend to implement some support for phone number auth in the Admin SDK. To start with we are going to address the following issues:


However, if you're looking for a method like signInWithPhoneNumber(), I don't think we will add it to the Admin SDK directly. In general we don't provide end user authentication methods in the Admin SDK. But perhaps a method to verify a user's phone number can benefit the Admin SDK. Can you explain your existing event flow with Cloud Functions so we can better understand your requirement?

Thanks,
Hiranya

On Wed, Jun 14, 2017 at 7:37 AM, Frank van Puffelen <frank.va...@gmail.com> wrote:
Similar question (unanswered for now, just linking them for future reference): https://stackoverflow.com/q/44547671

On Wednesday, June 14, 2017 at 6:55:21 AM UTC-7, Varun Gupta wrote:
Hi Firebase Team,

Are there any plans to provide phone number based authentication in the Admin SDK? On the documentation, I see that it is only provided in the client side SDK (Web, iOS, Android). I am currently using a third party service to perform phone number based authentication using cloud functions and custom authentication tokens and I wanted to shift to the phone number based authentication provided by Firebase but still as part of the cloud functions.

Thanks,
Varun

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Hiranya Jayathilaka

unread,
Jun 15, 2017, 1:14:06 PM6/15/17
to fireba...@googlegroups.com
I believe you can run this entire flow using the phone auth support available in Firebase client SDKs. The FirebaseUser object you get when you complete the phone number sign in contains the unique ID of the user. It also takes care of creating the user account in the Firebase project:


"After a user signs in for the first time, a new user account is created and linked to the credentials—that is, the user name and password, phone number, or auth provider information—the user signed in with. This new account is stored as part of your Firebase project, and can be used to identify a user across every app in your project, regardless of how the user signs in."



To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Varun Gupta

unread,
Jun 16, 2017, 12:02:28 AM6/16/17
to Firebase Google Group
Hi Hiranya,

I am using react-native for my app and I am not sure if the Web APIs for phone based authentication would work in react-native setup because in the examples, it uses 'window' object at some places and also asks to setup a reCaptcha verifier etc. which I am not sure if it would work well in the react-native setup.

One quick question, does the current authentication framework takes care of returning users and assign them the existing FirebaseUser object. For e.g., user installs the app and registers using their phone number, the uninstalls the app for some reason and then installs the app again and try to register with the same phone number. Would the authentication piece detect that and assign the user the existing FirebaseUser object and not create a new one?

Thanks,
Varun

Cordelia Link

unread,
Jun 21, 2017, 6:21:03 PM6/21/17
to Firebase Google Group
FirebaseUser is a client-side object. However its properties (including the user ID) should remain the same through the operations you described assuming some other process hasn't made changes to the same user. Potential changes that would cause differences include linking new authentication methods, profile updates, or account deletion. However these changes would involve deliberate action on the part of either the user or the app developer.
Reply all
Reply to author
Forward
0 new messages