Kotlin Firebase Authentication – How to Sign Up, Sign In, Sign Out, Verify Email | Android
Tags: kotlin, android, authentication, firebase
Published: 2021-05-22 05:59:02

https://grokonez.com/android/kotlin-firebase-authentication-how-to-sign-up-sign-in-sign-out-verify-email-android

Kotlin Firebase Authentication – How to Sign Up, Sign In, Sign Out, Verify Email | Android

Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app. In this tutorial, we're gonna build a simple register/login Android App using Firebase Email & Password authentication with Kotlin language.

More Practice:
- <a href="https://grokonez.com/uncategorized/kotlin-firebase-authentication-send-reset-password-email-forgot-password-android">Kotlin Firebase Authentication – Send Reset Password Email / Forgot Password | Android</a>
- <a href="https://grokonez.com/android/kotlin-firebase-authentication-google-sign-in-android">Kotlin Firebase Authentication – Google Sign In | Android</a>

<!--more-->
<h2>I. Way to do</h2>
<h3>1. Add Firebase to Android Project</h3>
<h4>1.1 Step by step</h4>
- Create new Android App including Kotlin support.
- From menu bar, <strong>Tool</strong> -> <strong>Firebase</strong>:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-firebase-auth-setup-tool.png" alt="kotlin-firebase-auth-setup-tool" width="211" height="199" class="alignnone size-full wp-image-9982" />

- Assistant window will be shown. Choose <strong>Authentication</strong>, then click on <strong>Email and password authentication</strong>:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-firebase-auth-setup-0.png" alt="kotlin-firebase-auth-setup-0" width="419" height="313" class="alignnone size-full wp-image-9983" />

- At the step <strong>1</strong>, click on <strong>Connect to Firebase</strong>:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-firebase-auth-setup-1.png" alt="kotlin-firebase-auth-setup-1" width="391" height="272" class="alignnone size-full wp-image-9984" />

- In new Window, choose <strong>Create new Project</strong> and fill in the name of Firebase Project:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-firebase-auth-setup-2.png" alt="kotlin-firebase-auth-setup-2" width="569" height="171" class="alignnone size-full wp-image-9985" />

- Click on <strong>Connect to Firebase</strong>, the Browser will show new Firebase Project that has just been created:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-firebase-auth-setup-5.png" alt="kotlin-firebase-auth-setup-5" width="700" height="481" class="alignnone size-full wp-image-9986" />

- Come back to Android Studio, at the step <strong>2</strong>, click on <strong>Add Firebase Authentication to your app</strong>:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-firebase-auth-setup-3.png" alt="kotlin-firebase-auth-setup-3" width="394" height="258" class="alignnone size-full wp-image-9987" />

- You will see a new window that shows the code will be add to <strong>build.gradle</strong> files. Click on <strong>Accept Changes</strong>:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-firebase-auth-setup-4.png" alt="kotlin-firebase-auth-setup-4" width="504" height="443" class="alignnone size-full wp-image-9988" />

- Now view your Project under Project type, you can see <strong>google-services.json</strong> file:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-firebase-auth-setup-json.png" alt="kotlin-firebase-auth-setup-json" width="293" height="364" class="alignnone size-full wp-image-9989" />
<h4>1.2 Check dependencies</h4>
Open Gradle file to check what happens, we can see that some code has been added:
- <strong>build.gradle</strong> (project-level):
<pre><code class="language-json">
buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.1.0'
    }
}
</code></pre>

More at:

https://grokonez.com/android/kotlin-firebase-authentication-how-to-sign-up-sign-in-sign-out-verify-email-android

Kotlin Firebase Authentication – How to Sign Up, Sign In, Sign Out, Verify Email | Android