Authentication is very important aspect of security in this digital era. It is basic building block for any security mechanism. If you are developing an android app which allows users to register to your app, then implementing authentication plays vital role in securing user privacy. In this article we are going to learn how we can add Firebase authentication in android project. If you are new to Firebase and want to get started with it then read this article to setup Firebase in Android Studio.
In order to add Firebase Authentication, open android project in Android Studio. Click on Tools and then Firebase as shown in image below.
This will open a sidebar containing various Firebase tools like Analytics, Authentication, Firestone and list goes on. Now, click on Authentication > Email and Password Authentication.
Connect to Firebase
Its time to connect your app to Firebase, click on Connect to Firebase. Firebase Console will start in your browser, here you need to click on the project where you have registered your app (See here how to register). Now Firebase Console will ask you to connect Firebase project to Android Studio. Once you do that your app will be connected to Firebase.
Finally we are ready to add authentication. Go back to Android Studio, here you can see Connect to Firebase button is changed to Connected in sidebar panel. Now, click on Add Firebase Authentication to your app. A pop up asking your permission to add dependencies to gradle will appear on screen.
Accept these changes and after some time Add Firebase Authentication to your app button will be changed to Dependencies set up correctly which means that you have successfully added Firebase Authentication to your project.
You are now ready to integrate authentication feature to your android app. Moreover, you are just two click away from adding other Firebase tools to your project. Just like Authentication, you can add Real-time Database, Storage and all other tools from sidebar panel of Android Studio.
Thanks for reading !