1. Home
  2. Docs
  3. Documentation
  4. Firebase Integration
  5. Enable SMS Phone Authentication

Enable SMS Phone Authentication

To enable SMS authentication with Firebase, there are a few things we need to configure, that will allow the app to send SMS to the users.

Enable Phone Authentication in Firebase

In Firebase, go to Authentication -> Sign-in method -> Phone Authentication and check the Enable switch.

phone authentication firebase

iOS Setup

1. Open the GoogleService-Info.plist file in Xcode, and copy the REVERSED_CLIENT_ID value to the clipboard

Make sure that this is your own file which you already downloaded from Firebase at the previous steps. The string will look like this:

com.googleusercontent.apps.525472070731-448dt91ch73bmujeotrvfb280ngguib2

2. In Xcode, select the Info.plist file, right click on it -> Open As -> Source Code

iOS sms authentication

3. In Info.plist source code, under CFBundleURLSchemes paste the client ID string copied at the previous step (by replacing the existing one)

iOS firebase phone auth

That’s it. Build and run the app again in Xcode, and now you’ll be able to see real SMS texts getting sent to any phone number.

Android Setup

For Android, setting up SMS Phone Authentication with Firebase is a slightly different than iOS.

1. Generate an upload key keystore

For MacOS, simply run the following command from the “android/app” folder of the React Native project:

keytool -genkeypair -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000

When asked for a password, just use android.

This will work when running the app in debug mode.

For Windows users, you can generate a private signing key using keytool. keytool must be run from C:\Program Files\Java\jdkx.x.x_x\bin.

If you are building the final app for production (Google Play publishing), follow the official React Native docs on how to generate a production signed binary.

If you are still in development mode, you can use the existing debug signing config that we’ve created for you already. You can see the configuration of this signing config in android/app/build.gradle file:

signing config react native

2. Generate a SHA-1 fingerprint certificate from the keystore

Simply run the following command (in android/app folder). Use the password android when prompted for it.

keytool -exportcert -list -v -alias androiddebugkey -keystore debug.keystore

This will generate a SHA-1 fingerprint. Copy it to clipboard.

sha-1 fingerprint

You can find more details in the official documentation from Google if you run into any issues.

3. Add the SHA-1 code to Firebase

In Firebase, go to Project Settings -> Select the Android app -> Add Fingerprint and place the SHA-1 fingerprint certificate in the corresponding field:

firebase sha-1 fingerprint

That’s it. Build and run the Android app again, and now you’ll be able to receive real SMS texts via Firebase.

Was this article helpful to you? Yes No

How can we help?