Kotlin Firebase Authentication – Google Sign In | Android

https://grokonez.com/android/kotlin-firebase-authentication-google-sign-in-android

Kotlin Firebase Authentication – Google Sign In | Android

In previous post, we had built a simple register/login Android App using Firebase Email & Password authentication. Now we can let users authenticate with Firebase using Google Accounts by integrating Google Sign In into Kotin Android App.

Related articles:

I. Way to do

1. Add Firebase to Android App

  • Read Kotlin Firebase Authentication – How to Sign Up, Sign In, Sign Out, Verify Email | Android and follow steps to enable and implement Firebase Auth in your Android App.

  • Add dependency: build.gradle (App-level):

    
    dependencies {
    // ...
    implementation 'com.google.android.gms:play-services-auth:11.0.4'
    }
    

    2. Enable Firebase Auth for Google Account

    Go to Your Firebase Project Console -> Authentication -> SIGN-IN METHOD -> Enable Google:
    firebase-google-signin-enable-console

    3. Steps to authenticate with Firebase

    3.1 Integrate Google Sign In into App

    1- Add the Google Sign-In button:

    
    
    

    2- Configure Google Sign In object to request the user data:
    When you configure the GoogleSignInOptions object, call requestIdToken:

    
    override fun onCreate(savedInstanceState: Bundle?) {
    // ...
    
    val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(WEB_CLIENT_ID)
            .requestEmail()
            .build()
    }

    With WEB_CLIENT_ID from Credentials page in the API Console -> OAuth 2.0 client IDs (Type Web Application).

3- Configure GoogleApiClient object with access to the Google Sign In API and the options above:

More at:

https://grokonez.com/android/kotlin-firebase-authentication-google-sign-in-android

Kotlin Firebase Authentication – Google Sign In | Android

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

Male avatar

loveprogramming

444 bài viết.
77 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
Male avatar
1 0
Tutorial Link: (Link) (Ảnh) Django is a Pythonbased free and opensource web framework that follows the modeltemplateview architectural pattern. A...
loveprogramming viết 6 tháng trước
1 0
Male avatar
1 0
https://loizenai.com/angular11nodejspostgresqlcrudexample/ Angular 11 Node.js PostgreSQL Crud Example (Ảnh) Tutorial: “Angular 11 Node.js Postg...
loveprogramming viết 5 tháng trước
1 0
Male avatar
1 0
Angular Spring Boot jwt Authentication Example Github https://loizenai.com/angularspringbootjwt/ (Ảnh) Tutorial: ” Angular Spring Boot jwt Authe...
loveprogramming viết 5 tháng trước
1 0
Bài viết liên quan
Male avatar
0 0
https://grokonez.com/kotlin/kotlinreadwritecsvfileexample How to read/write CSV file in Kotlin In this tutorial, we're gonna look at examples tha...
loveprogramming viết 7 ngày trước
0 0
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


Male avatar
{{userFollowed ? 'Following' : 'Follow'}}
444 bài viết.
77 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!