From a6293497f17b5a89808cb322f418f0777325c2f9 Mon Sep 17 00:00:00 2001 From: "maxime.zammit" Date: Tue, 19 Apr 2022 23:28:22 +0200 Subject: [PATCH 01/45] update google signin auth --- .../activity/AuthenticationActivity.kt | 54 ++++++++++-- .../vibester/auth/FireBaseAuthenticator.kt | 83 ++++++++++++++----- .../res/layout/activity_authentication.xml | 8 +- app/src/main/res/values/strings.xml | 2 +- 4 files changed, 111 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/ch/sdp/vibester/activity/AuthenticationActivity.kt b/app/src/main/java/ch/sdp/vibester/activity/AuthenticationActivity.kt index 5e536672b..0fec5155b 100644 --- a/app/src/main/java/ch/sdp/vibester/activity/AuthenticationActivity.kt +++ b/app/src/main/java/ch/sdp/vibester/activity/AuthenticationActivity.kt @@ -2,6 +2,7 @@ package ch.sdp.vibester.activity import android.content.Intent import android.os.Bundle +import android.util.Log import android.view.Window import android.widget.Button import android.widget.EditText @@ -10,13 +11,16 @@ import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import ch.sdp.vibester.R import ch.sdp.vibester.auth.FireBaseAuthenticator -import ch.sdp.vibester.helper.IntentSwitcher import com.google.android.gms.auth.api.signin.GoogleSignIn import com.google.android.gms.auth.api.signin.GoogleSignInClient import com.google.android.gms.auth.api.signin.GoogleSignInOptions +import com.google.android.gms.common.api.ApiException import com.google.android.gms.tasks.Task import com.google.firebase.auth.AuthResult import com.google.firebase.auth.FirebaseAuth +import com.google.firebase.auth.GoogleAuthProvider +import com.google.firebase.auth.ktx.auth +import com.google.firebase.ktx.Firebase import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject @@ -29,6 +33,8 @@ class AuthenticationActivity : AppCompatActivity() { @Inject lateinit var authenticator: FireBaseAuthenticator + private lateinit var auth: FirebaseAuth + private lateinit var email: TextView override fun onCreate(savedInstanceState: Bundle?) { @@ -38,11 +44,13 @@ class AuthenticationActivity : AppCompatActivity() { setContentView(R.layout.activity_authentication) val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) + .requestIdToken("7687769601-qiqrp6kt48v89ub76k9lkpefh9ls36ha.apps.googleusercontent.com") .requestEmail() .build() googleSignInClient = GoogleSignIn.getClient(this, gso) + auth = Firebase.auth val btCreateAcc = findViewById