Kotlin for Android: Firebase Auth

  1. Setup Firebase for Project
  2. Add Login Button to Main Activity
  3. Add Auth Code to Main Activity
  4. Create Logged In Activity
  5. Hook up Log out button on Logged In activity to Sign Out of Firebase

1. Setup Firebase for Kotlin

Create an Android Kotlin project and go through the following steps to get Firebase Auth installed and Configured. You need only execute 1 and 2 actions on third screenshot to configure email and password authentication

2. Add Login Button to Main Activity

3. Add Auth Code to Main Activity

Here we add an onClick Listener for login button which logs user in then starts the LoggedInActivity

4. Create LoggedInActivity

5. Hook up Logout Button To sign out of Firebase

Done!