Docly Child

Firebase Configuration

Estimated reading: 4 minutes

Creating A New Firebase Project

Step 1 : Create a new Firebase Project

After creating the project, you will be presented with this type of dashboard.

Step 2 – Go to the Project Settings and configure the Support Email

Add App with package name in Firebase Console

Step 3 – Click on Android Icon

Step 4 – Enter Package Name(e.g com.iqonic.example) and click on register app.

Step 5 – After registering the app, you will receive the Google JSON file; download it and save it to the Android/app/src.

Set up Firebase Authentication

Step 6 – Go to Build  —-> Authentication tab and click on Get started.

Select the Email/Password, Google one by one and Enable it. 

Note : Enable all the social logins you’ve given in your App. If you’ve provided Apple Login then select Apple tab too.

Re-check if all the modes you’ve selected for authentication are enabled or not.

Activate The Firestore Database

Step 7 – Go to Build —> Firestore Database tab and click on Get Started.

When you click the Get Started button, a dialogue will appear asking you to choose a mode, because we are testing, we will select the Start in Test Mode option and then click Next and then Enable it.

Step 8- Change the firestore’s rules to save the data in a database.

Before Changing Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if
          request.time < timestamp.date(2022, 8, 26);
    }
  }
}

After Changing Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}

SHA Fingerprint

IMPORTANT

SHA-1 fingerprint is a unique key generated for your PC that can be used for signing. It is important to have in the add firebase as we are using Google Login and OTP Login and to authorize this logins we need a SHA Fingerprint cerificate.

Add a SHA fingerprint to Firebase

Follow these steps if you didn’t initially provide a SHA certificate fingerprint for your Firebase Android app or if you need to add an additional one

  1. In your Project settings, go to the Your apps card.
  1. Select the Firebase Android app to which you want to add a SHA fingerprint
  1. Click Add fingerprint
  1. Enter or paste the SHA fingerprint, then click Save

How to generate the and SHA from Andriod Studio

IMPORTANT

There are two types of SHA Fingerprint, Release SHA Fingerprint and Debug SHA Fingerprint, Here we will how to generate both type of SHA Fingerprint

1. Debug SHA Fingerprint

  • Open Android Module and wait for the build to finish
  • On the right side of the screen, look for the “gradle” option and click it
  • By clicking, you will access the menu options. Select the first tab, and a dialog will appear
  • Enter “signingReport” into the dialog box
  • After building the gradle, the SHA and SHA256 will be displayed in the console log
  • Copy the SHA and SHA256 one by one and paste them into the above-mentioned open firebase window

2. Release SHA Fingerprint

  • Launch Android Module and wait for the build to finish
  • From the file menu, Select Project Structure
  • Navigate to the module section and Select App -> Singing Configurations
  • Click on “+” icon and add new module name “release”
  • Please select the JKS that you created at the time of release here (if JKS is not created then please create first and then select.)
  • Check that the release configuration is selected in the gradle file
  • Repeat the preceding steps to run the command, and the Release SHA will be displayed in the console log
Great! You have successfully configured Firebase!
Share this Doc
CONTENTS