googlesamples/google-signin-unity

Android google signin crash when add AdditionalScopes in configuration

dilipmanna opened this issue · 10 comments

When add additionalScope in GoogleSignIn.Configuration then android build is crash, but iOS build running fine. Below scope add code.
IEnumerable scopes = new List {"https://www.googleapis.com/auth/contacts.readonly","https://www.googleapis.com/auth/contacts"};
GoogleSignIn.Configuration.AdditionalScopes = scopes;

Can you share the log of the crash? That will help get a fix ready.

@claywilkinson I got the same issue without additional scope login in is working fine. When I add additional scopes it crashes. On iOS it works fine with and without additional scopes. This is the error I receive once I call the login with the additional scopes added.

01-19 11:02:06.489 3625-3655/be.cyborn.facialreco I/Unity: Calling SignIn
                                                           UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
                                                           UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
                                                           UnityEngine.Logger:Log(LogType, Object)
                                                           UnityEngine.Debug:Log(Object)
                                                           GoogleSignIniOS:Signin(GoogleSignInConfiguration) (at C:\google-signin-unity-master\GoogleSignInPlugin\Assets\GoogleSheet\GoogleSignIniOS.cs:33)
                                                           GoogleSignIniOS:SignIn() (at C:\google-signin-unity-master\GoogleSignInPlugin\Assets\GoogleSheet\GoogleSignIniOS.cs:22)
                                                           GoogleDriveSignInManager:SignIn() (at C:\google-signin-unity-master\GoogleSignInPlugin\Assets\GoogleSheet\GoogleDriveSignInManager.cs:81)
                                                           UnityEngine.Events.InvokableCall:Invoke() (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:165)
                                                           UnityEngine.Events.UnityEvent:Invoke() (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
                                                           UnityEngine.UI.Button:Press() (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\UI\Core\Button.cs:36)
                                                           UnityEngine.UI.Button:OnPointerClick(Poi
01-19 11:02:06.570 3625-3655/be.cyborn.facialreco A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x302ce297 in tid 3655 (UnityMain)
                                                          
                                                          [ 01-19 11:02:06.571   383:  383 W/         ]
                                                          debuggerd: handling request: pid=3625 uid=10311 gid=10311 tid=3655
01-19 11:02:06.650 3799-3799/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-19 11:02:06.650 3799-3799/? A/DEBUG: Build fingerprint: 'HUAWEI/VNS-L31/HWVNS-H:7.0/HUAWEIVNS-L31/C432B402:user/release-keys'
01-19 11:02:06.650 3799-3799/? A/DEBUG: Revision: '0'
01-19 11:02:06.650 3799-3799/? A/DEBUG: ABI: 'arm'
01-19 11:02:06.650 3799-3799/? A/DEBUG: pid: 3625, tid: 3655, name: UnityMain  >>> be.cyborn.facialreco <<<
01-19 11:02:06.650 3799-3799/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x302ce297
01-19 11:02:06.650 3799-3799/? A/DEBUG:     r0 302ce297  r1 302ce297  r2 00000000  r3 00000001
01-19 11:02:06.650 3799-3799/? A/DEBUG:     r4 ffffffff  r5 e28f0e00  r6 00000000  r7 ec72f728
01-19 11:02:06.651 3799-3799/? A/DEBUG:     r8 00000043  r9 ec77ef20  sl ec730329  fp ec73035a
01-19 11:02:06.651 3799-3799/? A/DEBUG:     ip 80000000  sp e53fded8  lr ee968505  pc ee930b72  cpsr 800e0030
01-19 11:02:06.654 3799-3799/? A/DEBUG: backtrace:
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #00 pc 00018b72  /system/lib/libc.so (strlen+21)
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #01 pc 00050501  /system/lib/libc.so (__strlen_chk+4)
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #02 pc 0029aed9  /system/lib/libart.so (_ZN3art6mirror6String21AllocFromModifiedUtf8EPNS_6ThreadEPKc+12)
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #03 pc 0027be97  /system/lib/libart.so (_ZN3art3JNI12NewStringUTFEP7_JNIEnvPKc+410)
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #04 pc 000068f1  /data/app/be.cyborn.facialreco-2/lib/arm/libnative-googlesignin.so (_ZN12googlesignin12GoogleSignIn16GoogleSignInImpl13CallConfigureEv+164)
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #05 pc 00006a01  /data/app/be.cyborn.facialreco-2/lib/arm/libnative-googlesignin.so (_ZN12googlesignin12GoogleSignIn16GoogleSignInImpl6SignInEv+28)
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #06 pc 00006bbd  /data/app/be.cyborn.facialreco-2/lib/arm/libnative-googlesignin.so (_ZN12googlesignin12GoogleSignIn6SignInEv+6)
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #07 pc 000062d5  /data/app/be.cyborn.facialreco-2/lib/arm/libnative-googlesignin.so (GoogleSignIn_SignIn+16)
01-19 11:02:06.654 3799-3799/? A/DEBUG:     #08 pc 00006850  <anonymous:ceaa4000>

@dilipmanna I made a work around/fix for the issue, if you comment CallConfigure(); on line 302&318 in google_signin.cc and then rebuild the .aar it no longer crashes when additional scopes are being added.

I tried to add additional scopes to sample project
private IEnumerable scope = new List {"https://www.googleapis.com/auth/youtube"},
GoogleSignIn.Configuration.AdditionalScopes = scope;
but it's didn't work. I had this error on android:
DeveloperError Exception of type 'Google.GoogleSignIn+SignInException' was thrown
I commented on CallConfigure() in google_signin.cc as written above, but it didn't help.
Without additional scopes, it's working fine for me. Could somebody help me with this issue?

Hey Foritari I realized later that it was the other way around and you have to comment out + CallConfigure(); on line 237 and not the other two as in my previous comment. At least at my end it solved the issue because I was able to use this script for signing into google drive and adjust google sheets.

@koenvandensteen thanks for your answer didn't work me either.
Could you please show me part of your login and scope add parts?

@koenvandensteen also could you pls send me your rebuilt version native-googlesign here em911roma@gmail.com.

Have the same problem when add AuthCode = true or TokenID = true in configuration.
Default configuration works but it not exactly what I want.

Can anyone please help and tell me a fix for the AdditionalScope Crash?