EddyVerbruggen / cordova-plugin-googleplus

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

The operation couldn't be completed. (com.google.GIDSignin error -4.) #413

Open patrickboulay opened 7 years ago

patrickboulay commented 7 years ago

Hi,

It's probably something very simple but I get this error when I call on iOS: window.plugins.googleplus.trySilentLogin({ 'webClientId': 'my_id.apps.googleusercontent.com', 'offline': true }, function (obj) { ify(obj)); // do something useful instead of alerting}, function (msg) {alert('error: ' + msg);} );

Other question, when I go on the google dev console to get my REVERSED_CLIENT_ID, my App name is automaticly filled by my Firebase project, thats good. But im not sure for the iOS bundle id, is it my apple identifier that I get for my App in iTune Connect (ten numbers)?

Thanks, Patrick

marcelof49 commented 6 years ago

I have the same problem, someone has solve it? When I try to connect in iOS, I receive the message "The operation couldn't be completed. (com.google.GIDSignin error -4.)"

Tiggilyboo commented 6 years ago

If you check this out, and Ctrl-F for -4, you can see the response code which says that there has never been a sign in on this keychain. So handle the response accordingly, request normal login instead of trySilentLogin. It should respond accordingly afterwards.

gayankalhara commented 6 years ago

This is the expected behavior if you're trying to login in the first time. A possible workaround is to first try silent login and if this error occurred try the normal login.

AbdullahEslah commented 3 years ago

you can check If you have an access token then signInSilently :

if (GIDSignIn.sharedInstance().currentUser?.authentication.accessToken != nil) { GIDSignIn.sharedInstance().signInSilently() }