CapacitorGoogleAuth icon indicating copy to clipboard operation
CapacitorGoogleAuth copied to clipboard

"errorMessage":"The operation couldn’t be completed. (com.google.GIDSignIn error -8.)"}

Open shinji1985 opened this issue 2 years ago • 7 comments

When i run my app in iOS in both of real device and simulator, Google authentication dialog is opened correctly and input my google account then submit. Google authentication is closed and I got the error below in console.

"errorMessage":"The operation couldn’t be completed. (com.google.GIDSignIn error -8.)"}

I use "@codetrix-studio/capacitor-google-auth": "^3.2.2". All settings seem to be correct.

my code is below

import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';
…
  async handleSignInClick() {
    let googleUser = await GoogleAuth.signIn();
    console.log('googleUser', googleUser);
…

Do you know why the error occur? This is my environment

Ionic:
   Ionic CLI                     : 6.20.8
   Ionic Framework               : @ionic/angular 6.5.3
   @angular-devkit/build-angular : 15.1.4
   @angular-devkit/schematics    : 15.1.4
   @angular/cli                  : 15.1.4
   @ionic/angular-toolkit        : 6.1.0

Capacitor:
   Capacitor CLI      : 4.6.2
   @capacitor/android : 4.6.2
   @capacitor/core    : 4.6.2
   @capacitor/ios     : 4.6.2

Utility:
   cordova-res : 0.15.4
   native-run  : 1.7.1

System:
   NodeJS : v18.12.1 
   npm    : 8.19.2
   OS     : macOS

Thanks

shinji1985 avatar Feb 12 '23 10:02 shinji1985

After I re-build project without firebase, it works! Thanks.

shinji1985 avatar Feb 12 '23 16:02 shinji1985

I found how to reproduce this problem. When I specify https://www.googleapis.com/auth/calendar or https://www.googleapis.com/auth/drive in scope. It works at first time. But after sign out then try to sign in, this error occur in iOS.

"errorMessage":"The operation couldn’t be completed. (com.google.GIDSignIn error -8.)"}

After I disconnect my google app from my account https://myaccount.google.com/permissions?continue=https%3A%2F%2Fmyaccount.google.com%2Fsecurity Then try to sign in, it works.

This problem seems to occur when I have already passed permissions to the designated scope on my Google account on the second and subsequent logins.

shinji1985 avatar Mar 06 '23 08:03 shinji1985

I am currently using a quick workaround for this whereby if I detect the error is -8, I will use the refresh flow

GoogleAuth.refresh()

This will enable me to get the authenticationToken and the refreshToken of the user that is currently being signed in

AlvinTCH avatar Apr 06 '23 14:04 AlvinTCH

Any progress on this issue ?

filipRisteski avatar May 01 '23 21:05 filipRisteski

Same issue here

bbjoern avatar Jun 09 '23 08:06 bbjoern

Any update on this?

zjmeyer25 avatar Aug 20 '23 20:08 zjmeyer25

I have the same issue in iOS With the same code, Android works fine, it is just the problem in iOS I am using the suggestion by @AlvinTCH . When I got the GIDSignIn error -8 message, I will try the refresh flow. If the refresh flow still have the problem, then I will throw the exception.

Using this logic, it works fine in my iOS app now

paddyabc avatar Aug 25 '23 08:08 paddyabc