Android FireBase Authentication Tutorial Part 1


Firebase is a set of backend services offered to the developers of platforms like, Android, IOS and Web. It allows us to create an application without a web server that performs authentication, data processing and storing.

Firebase provides many types sign-in methods to achieve authentication for a firebase user. Below are the provider list,

Here in this tutorial i am going to explain about how to implement the Email/Password authentication method (Sign In and Sign Up). Which is the first provider in the list. So please enable the status and continue through the below steps.

Step 1: Sign up at FireBase

You can sign in to the firebase with your Google account itself. Or you can use your GitHub account to Sign up at Firebase.com.

Firebase Sign in/Sign up Link

Step2: Create New Project

In the landing page of firebase.com you can see an option to create a new Project. Please click on the CREATE NEW PROJECT button which’s shown below.


It will open up a dialog to add project.


Enter the name of the project that you are going to create. This will be your project name. You can identify this project by this name in the project list. Add your current location too. If you are done then hit CREATE PROJECT

Step3: Choose Type Of The Application


Choose Android App.

Get SHA-1 Key Using Gradle Task

Next Step requires SHA-1 Key value. So create SHA-1 Key before go to the next step.

Linking between your app build and firebase project is secured with a SHA-1 key. During each build a secret SHA-1 key is generated by a gradle task. Through Android Studio IDE you can get this SHA-1 key value add it to firebase.

signingReport is the name of above mentioned gradle task that is generating SHA-1 key value. Through Android Studio we can run this task separately and access the result through run window any time.


Open Android Studio and open Gradle Task Window from right panel. If nothing listed there then please refresh.

Expand RootProject > app > Tasks > android > signingReport

Double click on signingReport to run it.

Result of the task will be shown in Run Window


For more detailed tutorial please go through the tutorial How To Obtain Certificate SHA-1 Fingerprint Using Android Studio

Step3: Add Application Details

Back to the firebase app. In the next screen of firebase you will be asked to fill package name and SHA-1 key. Please fill them and click ADD APP button.


Now you can see a json file called google-services.json is getting downloaded.

Step4: Copy Paste google-services.json To Application Directory

Please make sure to copy the downloaded google-services.json to your application directory like shown below.


Your FireBase Project Has Been Created!

Now go back to the Firebase dashboard and finish the last step. After that you can see a new Project created with above mentioned details. And it will be shown in the firebase dashboard.


Step5: Edit Gradle Files

As a part of setting up the project environment to add Firebase to Project we need to make some changes to following files. These changes are common to all kind of Firebase applications and are shown below.

1. build.gradle of project

Root build.gradle

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.0.0'

2. build.gradle of app module

app module build.gradle

apply plugin: 'com.android.application'

android {
  // ...

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:9.2.0'

apply plugin: 'com.google.gms.google-services'

After these changes to build.gradle files you will be asked to Gradle Sync. Please do it.

About author

Rojer is a programmer by profession, but he likes to research new things and is also interested in writing. Devdeeds is his blog, where he writes all the blog posts related to technology, gadgets, mobile apps, games, and related content.

Leave a Reply

Your email address will not be published. Required fields are marked *