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!

--

--

Parveen Khatkar
CodetrixStudio

 iOS specialist, .Net Core/C# enthusiast, Unity hobbyist. Occasional web dev, Docker Kubernetes tinkerer, OSS contributor. 👁 for good UI/UX. 📸🎮 lover.