EddyVerbruggen / cordova-plugin-googleplus

:heavy_plus_sign: Cordova plugin to login with Google Sign-In on iOS and Android
566 stars 626 forks source link

trySilentLogin() stopped working suddenly! #446

Open Trokal opened 7 years ago

Trokal commented 7 years ago

Hello,

Any idea if something changed in the Google API? because trySilentLogin() function stopped working suddenly! It has been working normally and today it decided to stop working!

googleLoginSilent()
{
  alert("Entered Silent Loggin");
  this.googlePlus.trySilentLogin(
  {
    'webClientId': 'XXXXXXXXXXXXXXXXXXXXX', // optional clientId of your Web application from Credentials settings of your project - On Android, this MUST be included to get an idToken. On iOS, it is not required.
    'offline': true
  }).then((obj) =>
  {
    if (!firebase.auth().currentUser) 
    {
      firebase.auth().signInWithCredential(firebase.auth.GoogleAuthProvider.credential(obj.idToken)).then((success) => 
      {
        alert("Logged In!");
        this.global.loginType=0;
       this.updateUserData(success);
      }).catch((gplusErr) => 
      {
        alert("Not curreny User");
        this.displayAlert(JSON.stringify(gplusErr),"GooglePlus failed")
      });
    }
  }).catch( (msg) => 
  {
    this.displayAlert(msg,"Gplus signin failed2")
  });
}

The problem is that ts not entering the if (!firebase.auth().currentUser)

jaigtz88 commented 6 years ago

did it catch an error?

sushantpande commented 6 years ago

Experiencing a similar issue with error code as 4

bhavin9695 commented 5 years ago

This thread is old but it might help other users.

try with offline : false. it worked for me

ref : https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/464

but0n commented 4 years ago

Experiencing a similar issue with error code as 4

Me too