Authenticate Firebase Using Google Sign-In in Capacitor
Published in
1 min readJun 6, 2019
Following up on Authenticate Using Google Sign-In in Capacitor, we gonna authenticate our Firebase app by passing on the idToken
we got from “Google Sign-In” via capacitor plugin to Firebase.
This is how you would do it in an Angular project using AngularFire but the idea remains the same everywhere else.
async googleSignIn() {
let googleUser = await Plugins.GoogleAuth.signIn();
const credential = auth.GoogleAuthProvider.credential(googleUser.authentication.idToken);
return this.afAuth.auth.signInAndRetrieveDataWithCredential(credential);
}
After successfully passing in the idToken
your authStateChange
event will be fired and you are good to go!