- Mastering Firebase for Android Development
- Ashok Kumar S
- 298字
- 2021-06-18 18:49:16
Configuring for Email Authentication
The following steps illustrate what necessary actions are to be taken to integrate the Firebase Authentication:
- Create a new project with Empty Activity as the preferred template. In this project, we will explore social site integration and other authentication services. It is recommended you use the latest version of Android Studio and dependencies:
- After successful project creation, go to Tools | Firebase within Android Studio and select Authentication on the right-hand-side of the assistant panel window.
- In the Assistant window, click on Connect to Firebase. If you have already created a project in the Firebase console, you can choose it. For the scope of exploring the Authentication, it is good if you can create a new project and allow Android Studio to register the clients. After successful creation, Android Studio will notify with the status of the application:
- After that, click on Add Firebase Authentication to your app and accept the changes. After successful project sync, we shall see additional dependencies in your build.gradle file and also a google-services.json file in the project scope:
//Add this dependency to gradle.build file
implementation 'com.google.firebase:firebase-auth:11.8.0'
- The final step is to add the FirebaseUI dependencies. The following table explains the FirebaseUI and Firebase SDK version mapping.
As of the date of writing, the newest dependency version number is 3.1.0. It might be different when you read this book. Please add the latest dependency because most of the syntax remains the same.
- Add the following Gradle dependency to your build.gradle file in the module scope:
// FirebaseUI for Firebase Auth compile 'com.firebaseui:firebase-ui-auth:3.1.3'
Note: Add this Maven URL because the fabric components need to be downloaded from this repository:
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}