[IONIC 4] google plus plugin not working

Hello,

I’m updating my app to ionic 4, and trying to login with google plus, but the function googlePlus.login() doesn’t seem to work. Even in a try{}catch{}, there is no error showing up…

my code :

async signInWithGoogle() {

  console.log('afAuth.signInWithGoogle()')
  if (this.plt.is('cordova')) {
    console.log('cordova')
    try {

      const gplusUser = await this.googlePlus.login({
        'webClientId': 'MYWEBCLIENTID.apps.googleusercontent.com',
        'offline': true
      })
      console.log(gplusUser)
      return await this.afAuth.auth.signInWithCredential(firebase.auth.GoogleAuthProvider.credential(gplusUser.idToken))
  
    } catch(err) {
      console.log(err)
      return {'error' : err}
    }
  }
  else {
    return this.oauthSignIn(new firebase.auth.GoogleAuthProvider());
  }
}

this is what the console returns :

afAuth.signInWithGoogle()
cordova

I haven’t changed my app id or sha1 certificate.

my ionic info

Ionic:

   ionic (Ionic CLI)             : 4.7.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.1
   @angular-devkit/build-angular : 0.11.4
   @angular-devkit/schematics    : 7.1.4
   @angular/cli                  : 7.1.4
   @ionic/angular-toolkit        : 1.2.2

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.13
   @capacitor/core           : 1.0.0-beta.13

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0, browser 5.0.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 15 other plugins)

System:

   ios-deploy : 2.0.0
   NodeJS     : v10.3.0 (/usr/local/Cellar/node/10.3.0/bin/node)
   npm        : 6.1.0
   OS         : macOS Mojave
   Xcode      : Xcode 9.4.1 Build version 9F2000

Hope you can help me

can no one help me ?

Hello!, found any solution for this? I have the same issue

I’m wondering this too. I was just going add this (google login) to my new project, but does it still work at all as Google is shutting down GooglePlus???

@Alejandr : I haven’t found any solution yet… I have posted an issue on the github page for this plugin but it has been solved very quickly without any further investigation. After days of struggle, I have finally decided to suppress the “connect with google” option from my app, and I am still looking for a way to put it back…

@jylikorpi The plugin uses another API for google login, you can read more here

I made a project to test Login with Google and works succesfull but now I´m doing the real implementation in another project and not works, not shows the screen to choose google account and not gives any error. Seems as the function is not executed. Anyone can help me? I try to downgrade the plugins to the version when works in my last project but when compiles give me errors and not works so I had to back to the latest version that let me compile without errors

The problem was resolved using the same versión from play serviced versión due to when use different versions occurs some errors.

So I change this values

"cordova-plugin-request-location-accuracy": {
        "PLAY_SERVICES_LOCATION_VERSION": "16.+"
      },
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "MY_REVERSED_ID",
        "PLAY_SERVICES_VERSION": "11.8.0"
      },

To

"cordova-plugin-request-location-accuracy": {
        "PLAY_SERVICES_LOCATION_VERSION": "11.8.0"
      },
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "MY_REVERSED_ID",
        "PLAY_SERVICES_VERSION": "11.8.0"
      },

And delete platforms, www and plugins folder and executes the “ionic cordova build android” command and all works

1 Like

Thank you so much bro.

I stuck on this. Tried everything and you gave solution very easily . Thank you so much. God bless you.

1 Like