Read More

Android Using Firebase Auth to Authenticate Users for Your Application.

In this Blog, we are going to have a look at how to use Firebase Auth to Authenticate Users for Your Application.

Lets First have a look at the advantages of using Firebase Authentication:

  1. Easy Integration for various social platforms like Facebook, Twitter, Google.
  2. Less piece of Code and Fast implementation.
  3. High Security.
  4. Easy monitoring of users.
  5. Highly customizable.(They provide default UI for every platform).

You can have a detailed explanation for each point from the official documents.

Over here, I have used the default Firebase Auth UI. You can definitely surpass this and use your views.

APPROACH :

  1. Create a SignIn Button.
  2. On click of the Button, call startActivityForResult Method (See code)
  3. Override onActivityResult.

Let’s have a look at the code:

Module Level DEPENDENCIES

Project Level DEPENDENCY

CODE :

Button and listener:

onActivityResult :

That’s all.

Also, don’t forget to add google-services.json file and enable Authentication methods you want to use from the firebase console.

NOTE:  In order to enable the Authentication methods, all you need to do is:

  1. Open Firebase console.
  2. Select Authentication Tab from the Left side Menu.
  3. Select the  Sign-In Method Tab.
  4. Select the Sign In Methods from the list you want.
  5.  Slide the slider to Right in order to enable the selected Sign-in Method.

And All is set.

This will enable all the SignIn methods you want to include in your Application.

Keep Coding and Keep Sharing 🙂

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close