Add Email Authentication To Xamarin.Android App Using Firebase - Part One

Today, I am going to show you how to add Email authentication in Android using FireBase. Android Support Library v7 AppCompat, Android Support Design Library, Xamarin.Firebase.Auth Nuget Package, Register Firebase App, Firebase APP ID, Firebase API KEY.

Introduction
 
Today, I am going to show you how to add email authentication in Xamarin.Android using FireBase. Or in simple words, we will be adding email login to a Xamarin.Android App using Firebase.
 
What is Firebase?
 
FireBase is a NoSQL Real-time Database that helps you store the data of your app on the Cloud devoid of any irritation of creating and sustaining the server. 
 
Prerequisites
  • Visual Studio 2017
  • Android Support Library v7 AppCompat
  • Android Support Design Library
  • Xamarin.Firebase.Auth Nuget Package
  • Registered Firebase App
  • Firebase APP ID
  • Firebase API KEY 
The steps given below are required to be followed in order to create a Xamarin Firebase Authentication app in Xamarin.Android, using Visual Studio.
 
Step 1 - Create a Project
 
Open Visual Studio and go to New Project-> Templates-> Visual C#-> Android-> Blank app. Give it a name like XamarinFirebaseAuth.
 

Step 2 - Install Android Support Library v7 AppCompat
 
Go to Solution Explorer-> Project Name-> References. Then, right-click "Manage NuGet Packages" and search for AppCompat. Install the AppCompat package.
 
 
 
Step 3 - Install Android Support Design Library
 
Go to Solution Explorer-> Project Name-> References. Then, right-click "Manage NuGet Packages" and search for Design Library. Install the Design Library package.
 
 
Step 4 - Install Xamarin.Firebase.Auth Nuget Package
 
Similarly, install the Xamarin Firebase Auth package.
 
 
 
Step 5 - Connect an Android app to FireBase 
 
Open Firebase, go to the console and click on "Add Project". Enter the project name and country as shown below and then click on "Create Project".
 
 
Step 6

Now, click on ‘Add Firebase to your Android App’ and copy the package name of your app. All other fields are optional and can be left blank for now.
 
 
 


Step 7

Now, download the google-services.json file and copy it to the app folder of your Android project.
 
 
If everything goes well, you will see your project added to the Firebase console.
 
 
Step 8 - Email Authentication
 
Go to Firebase Console, select your project, and click on "Authentication" tab. Click on Sign-in method, select Email/Password, and enable it.
 
 
 
Step 9 Get API Key
 
Go to Firebase console, select your Project -> click on Settings -> General -> go to your Project details, and copy your Web API Key.
 
 
Step 10 - Get App ID
 
Go to Firebase console, select your Project -> click on Settings -> General -> go to your App details, and copy your App ID.