Firebase configuration for OTP verification

You must first install Classified Listing – Mobile Number Verification Plugin in web and configure it following this Documentation.
If you select Twilio, you do not need to configure anything in the app.
To setup Firebase, you need to follow the below steps:

1. Creating Firebase web app
Open this link . Signup for a firebase account if you haven’t already. Login to Firebase console, setup a new project by pressing + Add Project or use an existing one.


Then select +Add app And select android or ios and provide further detail. Make sure that the Android package name you enter is the same as the value of android.package in your app.json. And similarly add iOS project.





(Android only) Go to your Firebase project’s settings, scroll down to “Your apps” and select your Android app. Under SHA certificate fingerprints, click Add fingerprint, and add Google Certificate Fingerprint.
You’ll get Google Certificate Fingerprint by following steps:
(You need to build your app once before these steps to generate credentials)
– run eas credentials
– Select Android
– Select profile (production)
– You’ll get all the credentials in the console. From here copy the “SHA1 Fingerprint“. This SHA1 Fingerprint is Google Certificate Fingerprint.
*** If you haven’t already run eas build -p android for this project, you’ll need to do that first before getting the Google Certificate Fingerprint.



Download the google-services.json  for android and Googleservice-info.plist file for iOS and place it in your app’s root directory.


In your app.json, add an android.googleServicesFile field with the relative path to the google-services.json file you just downloaded. If you placed it in the root directory, this will probably look like . Similarly do for iOS. see below code.

{
  ...
  "ios" : {
    "googleServicesFile": "./GoogleService-Info.plist"
    ...
  }
  ...
  "android": {
    "googleServicesFile": "./google-services.json",
    ...
  }
}




Open app > services > firebaseConfig.js file
set the enabled value to true

Now from the firebase console, select Build > Authentication from the left sidebar and press “Get Started”




Under Sign-in-method select “Phone”

Now press the Slider button to enable phone and click “Save”

  • Now run the following command in terminal “npx expo install @react-native-firebase/app @react-native-firebase/auth”
    npx expo install @react-native-firebase/app @react-native-firebase/auth
  • Now open app.json file and put this line under plugin section
    "@react-native-firebase/app",


  • Finally open screens > OTPVerificationScreen.jsx and remove “//” from the marked line.



    – After configuring OTP verification, please create a new build and test with that. Older build will produce errors.

6. After you upload the app in play store and get approved, you need to log in to your play console account and select your published app. On the next page select “App Signing” under “Setup” option from the left sidebar. Scroll down to “App signing key certificate” You’ll see something like the image below. Copy the “SHA-1 certificate fingerprint” under “App signing key certificate”.
Go to your firebase project, open the android app you created in step 2. Now add the SHA-1 certificate fingerprint” to your project.
Similarly Copy the “SHA-256 certificate fingerprint” And add it to firebase project.
If you miss this step, google signin will not work in the app downloaded from play store.