-
-
Notifications
You must be signed in to change notification settings - Fork 180
Any way to log in with google and CredentialManager? #764
-
hi i am trying to log in with google and its one tap using credential manager but i have not found the way to do it.
do you have to do it from the common part or with expect/actual?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
@Puskistolero92 if your firebase users have google accounts linked to them, then theres a few ways to implement the Google sign in step, but this library doesn't manage that for you as far as I know. Theres a few guides on how to implement Google single sign on such as:
https://medium.com/@arezoo.nazerdeylami/implementing-google-sign-in-with-kotlin-and-compose-multiplatform-8fad1898b866
https://proandroiddev.com/integrating-google-sign-in-into-kotlin-multiplatform-8381c189a891
https://euryperez.dev/compose-multiplatform-login-with-google-cc3217a99349
And a library that can help is https://github.com/mirzemehdi/KMPAuth
After the google single sign on is complete, your app receives an id_token and access_token, and to log into the firebase user you can do the something like:
import dev.gitlive.firebase.auth.FirebaseAuth import dev.gitlive.firebase.auth.GoogleAuthProvider val tokenResult = googleAuth.signIn() // implementation you chose for google single sign in val cred = GoogleAuthProvider.credential(tokenResult.idToken, tokenResult.accessToken) val firebaseResult = auth.signInWithCredential(cred)
Beta Was this translation helpful? Give feedback.