Subscribe Us

header ads

Firebase Authentication | How to set up Firebase Authentication

Firebase Authentication

This blog will tell you everything there is to know about firebase authentication, it's pros, how to use it in your app, etc.

According to https://firebase.google.com/docs/auth, Firebase authentication is a feature of firebase that provides backend services, easy-to-use SDK's and readymade UI libraries that is mainly used to authenticate users in your mobile or web app.

Most apps of today must require user-identity so that the app can save the user data and provide different types of services to the user. This process of verifying the user and obtaining it's identity along with some other useful information is known as authentication. Authentication is used in almost all of the websites and apps of companies : Facebook, Google, YouTube, Twitter, Spotify, you name it!

If you're still confused about authentication , I'll give you the simplest example. Go to your favourite social media. Remember how everytime you logout out of your account you have to put in your email and password or directly signing in with  facebook or google. Well, that's exactly what authentication is.

What's really cool about firebase is that it makes authentication and user-account management super easy, convenient and safe. You don't have to go through hell just to validate your user once you integrate firebase authentication into your app. If you didn't use firebase, you would have to first create your own authentication system, create a database to manage the data from the user authentication, create a system to manage user-accounts and all of that complex work, but firebase already does that for you. The main motto of firebase authentication is, 'That's Firebase Auth, allowing you to focus on your users and not the sign-in infrastructure' 

Firebase Authentication works on all three platforms : The web, IOS and android. There are plenty of options for user-authentication in firebase. They include:

1. Email/Password    

 This is the most common way of authentication users by typing in your email address along with your unique password.

2. Phone                                                                                                                         

 Everyone has a phone number. There is also phone authentication in firebase which accepts users phone numbers.

3 Google

Powered by Google, Firebase provides Google sign-in options as majority of the web-users have google accounts

4 Play games and Game center                                                                                                   

These are the popular gaming platforms which have their own form of authentication and firebase supports this as well

5 Facebook                                                                                                                    

Authentication through facebook account is now possible through firebase, making it super easy and accessible by people.

6. Twitter                                                                                                                                

Twitter is also a famous social media platform so considering it's popularity firebase also has a twitter authentication option.

7. GitHub                                                                                                                            

 Github is a popular website for people to share code data. Firebase allows users to login and through their GitHub accounts as well

8. Anonymous                                                  

Firebase supports enabling anonymous guest accounts in your app without requiring any credentials from users still maintaining proper security.


In order to authenticate users from firebase, here are the step-by-step procedures:

1. First of all install firebase in your project via terminal

2. After installation go to the official webpage of firebase https://firebase.google.com and create a project

3. Create a web-app inside the project. Then you will get a code for joining firebase with your project. 

4. Copy that code into your project and paste it exporting the variable 'auth' after writing the syntax 'const auth=firebase.auth()'

5. Go to your web app, go to authentication option and enable the sign-in options you want to add to your project

6. From https://firebase.google.com/docs/auth/where-to-start?authuser=0, go to the web option and then you will get the syntax for building the authentication system from various options like email/password, google, etc copy and paste that syntax. 

7. There you go, you have just added firebase authentication into your app in these simple steps


How does Firebase authentication work?

Once you get user's authentication credentials in your app powered by firebase auth, these credentials with be passed to the Firebase Authentication SDK. The backend serives of firebase will then validate those credentials and give back a response to the client telling whether the user is verified or not.

In firebase auth, after a successful sign in, we can get get access and inspect user accoung details and we cal also control the user's account. If you want to add security rules or modify something you can use firebase cloud functions for creating a user-ban system or changing the data access method of user.


That's basically all you need to know on how to add firebase authentication. These are the main advantages of firebase authentication over other authentication systems that you need to build from programming languages like php and python, etc.

Some advantages of Firebase Authentication are as follows:

1. You can get a full guide along with the syntax for applying firebase syntax in your account. You just need to copy and paste to important firebase auth into your app

2. It comes with a account system that allows us to inspect the users's account info - and gives us full control over them

3. It's so easy and fast in comparison to other alternatives

4. It's super customizable according to our needs

Hopefully you now have a great idea on what firebase authentication. This information will be adequate for you to start using the firebase auth in your app easily and quickly.

Post a Comment

0 Comments