I am using \"Google Sign-In\" in my app. Hence I use the class GoogleApiClient to get the user email and the ID token that I need for my backend.
When the user signs
To add to the two answers above by Isabella and Ola, if you're using the new sign in lib with Firebase:
FirebaseAuth.getInstance().currentUser?.let{
//create sign-in options the usual way
val googleSignInClient = GoogleSignIn.getClient(context, gso)
googleSignInClient.silentSignIn().addOnCompleteListener {
val account: GoogleSignInAccount? = it.result
//get user info from account object
}
}
Also, this can be called from the UI thread.
FirebaseAuth.getInstance().currentUser will always return the user object if you have signed in once before.