Firebase Phone Auth

When Firebase was first released, it came with a number of authentication schemes:

You could build an app for email & password authentication (iOS, Android, Web), where the user provides you with basic details — and Firebase would manage signing in using those as their identity. You could also build using federated identity where, instead of signing up for your app, users could simply sign in using credentials provided by third parties such as Google, Facebook, Twitter or GitHub, or anonymous authentication where you could apply security rules to people who haven’t yet signed up.

One type of authentication that was requested by a number of developers was the ability to sign in using a phone number. With that in mind, we’re delighted to announce that Firebase Auth now supports phone number authentication. If you’re currently using the Digits SDK for phone number auth, check out the announcement here for details on the migration to Firebase Auth.

Here’s how Firebase Phone Auth works.

The Sign In Screen

Here’s an example of an app that supports phone auth as well as federated identity via Google and Facebook, and basic email/password authentication.

It has been built using FirebaseUI, so many of the flows that you see in this article are automatically implemented for you when you integrate it.

As you can see at the bottom of the screen, there’s a ‘Sign in with Phone’ option.

Let’s take a look at what happens when the user taps that.

Sign In Flow

When the user first taps the Sign In with Phone button, they’ll enter the phone number for the device. When they press ‘Verify’, the number will be sent to Firebase, which will generate a 6-digit code that is sent via SMS to their device.

If the user enters the correct code, Firebase will validate them and add them as a recognized user. They’ll then stay signed in for future sessions.

You’ll see them as a verified user in the Firebase Console:

You can learn more about Firebase Authentication on the Firebase Developers Site.

Firebase UI is an Open Source library that lets you quickly get up and running with best-practice sign in and sign up flows. Phone Auth with Firebase UI is presently available on iOS and the Web, and coming soon to Android.

We’re continuing to grow and build Firebase and Firebase Authentication, and we’d love to hear your feedback, so please reach out to us at firebase.google.com/support.