Search code examples
firebaseionic-frameworkcapacitor

Firebase Google sign in won't add user


I'm using Ionic with Capacitor to develop an iOS and Android application. I'm trying to use social login using Google's Firebase. I followed a tutorial, and added the Google Sign in to my application, which does work, but the user (After signing does not appear on the "Authentication" section in the Firebase console. I'm using codetrix-studio/capacitor-google-auth" and this is how I sign the user in:

async googleSignIn() {
  let googleUser = await Plugins.GoogleAuth.signIn();
  let user: User = {
      uid: googleUser.id,
      displayName: googleUser.name,
      email: googleUser.email,
      photoURL: googleUser.imageUrl
  }
}

I also saw that on the Ionic page there is something called Firebase Authentication (which looks like it is used Cordova and no Capacitor plugin is available). Seems like it serves the same purpose as capacitor-google-auth, but I'm not really sure.

This is the link: https://ionicframework.com/docs/v3/native/firebase-authentication/

Not sure how to proceed, I do got the Google sign in to work, and I do get the user back, but it won't appear on the Authentication tab.


Solution

  • I've managed to make this work using Capacitor Firebase Auth Plugin.

    There are some configurations you need to do in order to support firebase authentication from your iOS and Android apps. Everything is explained here, so make sure to follow this guide carefully.

    I also wrote a tutorial about Firebase Authentication in Ionic Apps and I mention how to solve this issue and how to configure everything for Google Sign In with Firebase.