Giter Site home page Giter Site logo

googlesamples / google-signin-unity Goto Github PK

View Code? Open in Web Editor NEW
399.0 25.0 218.0 235 KB

Google Sign-In API plugin for Unity game engine. Works with Android and iOS.

License: Other

C# 13.57% Objective-C 1.12% Objective-C++ 11.70% CMake 2.49% C++ 38.50% Java 31.26% Shell 0.05% Ruby 0.62% C 0.70%

google-signin-unity's Introduction

Google Sign-In Unity Plugin

Copyright (c) 2017 Google Inc. All rights reserved.

Overview

Google Sign-In API plugin for Unity game engine. Works with Android and iOS. This plugin exposes the Google Sign-In API within Unity. This is specifically intended to be used by Unity projects that require OAuth ID tokens or server auth codes.

It is cross-platform, supporting both Android and iOS.

See Google Sign-In for Android for more information.

Configuring the application on the API Console

To authenticate you need to create credentials on the API console for your application. The steps to do this are available on Google Sign-In for Android or as part of Firebase configuration. In order to access ID tokens or server auth codes, you also need to configure a web client ID.

How to build the sample

Get a Google Sign-In configuration file

This file contains the client-side information needed to use Google Sign-in. The details on how to do this are documented on the Developer website.

Once you have the configuration file, open it in a text editor. In the middle of the file you should see the oauth_client section:

      "oauth_client": [
        {
          "client_id": "411000067631-hmh4e210xxxxxxxxxx373t3icpju8ooi.apps.googleusercontent.com",
          "client_type": 3
        },
        {
          "client_id": "411000067631-udra361txxxxxxxxxx561o9u9hc0java.apps.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.your.package.name.",
            "certificate_hash": "7ada045cccccccccc677a38c91474628d6c55d03"
          }
        }
      ]

There are 3 values you need for configuring your Unity project:

  1. The Web client ID. This is needed for generating a server auth code for your backend server, or for generating an ID token. This is the client_id value for the oauth client with client_type == 3.
  2. The package_name. The client entry with client_type == 1 is the Android client. The package_name must be entered in the Unity player settings.
  3. The keystore used to sign your application. This is configured in the publishing settings of the Android Player properties in the Unity editor. This must be the same keystore used to generate the SHA1 fingerprint when creating the application on the console. NOTE: The configutation file does not reference the keystore, you need to keep track of this yourself.

Create a new project and import the plugin

Create a new Unity project and import the GoogleSignIn-1.0.0.unitypackage (or the latest version). This contains native code, C# Unity code needed to call the Google Sign-In API for both Android and iOS.

Import the sample scene

Import the GoogleSignIn-sample.unitypackage which contains the sample scene and scripts. This package is not needed if you are integrating Google Sign-in into your own application.

Configure the web client id

  1. Open the sample scene in Assets/SignInSample/MainScene.
  2. Select the Canvas object in the hierarchy and enter the web client id in the SignInSampleScript component.

Building for Android

  1. Under Build Settings, select Android as the target platform.
  2. Set the package name in the player settings to the package_name you found in the configuration file.
  3. Select the keystore file, the key alias, and passwords.
  4. Resolve the Google Play Services SDK dependencies by selecting from the menu: Assets/Play Services Resolver/Android Resolver/Resolve. This will add the required .aar files to your project in Assets/Plugins/Android.

Building for iOS

For iOS, follow the instructions for creating a GoogleService-Info.plist file on https://developers.google.com/identity/sign-in/ios/start-integrating.

In Unity, after switching to the iOS player, make sure to run the Play Services Resolver. This will add the required frameworks and libraries to the XCode project via CocoPods.

After generating the XCode project from Unity, download the GoogleService-Info.plist file from the Google Developers website and add it to your XCode project.

Using the Games Profile to sign in on Android

To use the Play Games Services Gamer profile when signing in, you need to edit the dependencies in Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml.

Uncomment the play-services-games dependency and re-run the resolution.

Using this plugin with Firebase Auth

Follow the instructions to use Firebase Auth with Credentials on the Firebase developer website.

Make sure to copy the google-services.json and/or GoogleService-Info.plist to your Unity project.

Then to use Google SignIn with Firebase Auth, you need to request an ID token when authenticating. The steps are:

  1. Configure Google SignIn to request an id token and set the web client id as described above.
  2. Call SignIn() (or SignInSilently()).
  3. When handling the response, use the ID token to create a Firebase Credential.
  4. Call Firebase Auth method SignInWithCredential().
    GoogleSignIn.Configuration = new GoogleSignInConfiguration {
      RequestIdToken = true,
      // Copy this value from the google-service.json file.
      // oauth_client with type == 3
      WebClientId = "1072123000000-iacvb7489h55760s3o2nf1xxxxxxxx.apps.googleusercontent.com"
    };

    Task<GoogleSignInUser> signIn = GoogleSignIn.DefaultInstance.SignIn ();

    TaskCompletionSource<FirebaseUser> signInCompleted = new TaskCompletionSource<FirebaseUser> ();
    signIn.ContinueWith (task => {
      if (task.IsCanceled) {
        signInCompleted.SetCanceled ();
      } else if (task.IsFaulted) {
        signInCompleted.SetException (task.Exception);
      } else {

        Credential credential = Firebase.Auth.GoogleAuthProvider.GetCredential (((Task<GoogleSignInUser>)task).Result.IdToken, null);
        auth.SignInWithCredentialAsync (credential).ContinueWith (authTask => {
          if (authTask.IsCanceled) {
            signInCompleted.SetCanceled();
          } else if (authTask.IsFaulted) {
            signInCompleted.SetException(authTask.Exception);
          } else {
            signInCompleted.SetResult(((Task<FirebaseUser>)authTask).Result);
          }
        });
      }
    });

Building the Plugin

To build the plugin run ./gradlew -PlintAbortOnError build_all. This builds the support aar library with lint warnings as errors and packages the plugin into a .unitypackage file. It also packages the sample scene and script in a separate package.

There's also a shortcut for linux/mac: ./build_all.

Questions? Problems?

Post questions to this Github project.

google-signin-unity's People

Contributors

calee88 avatar claywilkinson avatar johnb003 avatar lukezbihlyj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-signin-unity's Issues

Rare crash on startup

We are using Unity 2017.4.4 and have a user on Android 8 that was able to send us this log. As best I can make out, it looks like NewGlobalRef is failing because the reference being passed in is already invalid somehow.

07-13 16:20:35.402  2604  2635 F zygote  : indirect_reference_table.cc:58] JNI ERROR (app bug): accessed deleted Global 0x2c86

07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514] Runtime aborting...
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514] Aborting thread:
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514] "UnityMain" prio=5 tid=13 Runnable
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | group="" sCount=0 dsCount=0 flags=4 obj=0x12c41270 self=0xd50d4600
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | sysTid=2635 nice=0 cgrp=default sched=0/0 handle=0xc76ff970
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | state=R schedstat=( 1530772739 28633897 1766 ) utm=136 stm=17 core=5 HZ=100
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | stack=0xc75fd000-0xc75ff000 stackSize=1038KB
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | held mutexes= "abort lock" "mutator lock"(shared held)

07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #00 pc 002c521f  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+130)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #01 pc 00356cd1  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+200)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #02 pc 003531a3  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+34)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #03 pc 00343b9d  /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+28)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #04 pc 0034397f  /system/lib/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+346)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #05 pc 00338877  /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+110)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #06 pc 00338f7f  /system/lib/libart.so (_ZN3art7Runtime7AborterEPKc+10)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #07 pc 003effad  /system/lib/libart.so (_ZN7android4base10LogMessageD1Ev+456)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #08 pc 001c8757  /system/lib/libart.so (_ZN3art22IndirectReferenceTable17AbortIfNoCheckJNIERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE+166)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #09 pc 00234c63  /system/lib/libart.so (_ZNK3art22IndirectReferenceTable10GetCheckedEPv+266)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #10 pc 0023145b  /system/lib/libart.so (_ZN3art9JavaVMExt12DecodeGlobalEPv+10)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #11 pc 0035ab4b  /system/lib/libart.so (_ZNK3art6Thread13DecodeJObjectEP8_jobject+162)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #12 pc 0025fdf3  /system/lib/libart.so (_ZN3art3JNI12NewGlobalRefEP7_JNIEnvP8_jobject+374)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #13 pc 000064c5  /data/app/com.thirdtime.photofinishtwo-K8CqbIHzxiIdyy0X4xOY9g==/lib/arm/libnative-googlesignin.so (_ZN12googlesignin12GoogleSignIn16GoogleSignInImplC2EP8_jobject+32)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #14 pc 00006ac7  /data/app/com.thirdtime.photofinishtwo-K8CqbIHzxiIdyy0X4xOY9g==/lib/arm/libnative-googlesignin.so (_ZN12googlesignin12GoogleSignInC1EP8_jobject+22)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #15 pc 0000616b  /data/app/com.thirdtime.photofinishtwo-K8CqbIHzxiIdyy0X4xOY9g==/lib/arm/libnative-googlesignin.so (GoogleSignIn_Create+30)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #16 pc 0211ce54  /data/app/com.thirdtime.photofinishtwo-K8CqbIHzxiIdyy0X4xOY9g==/lib/arm/libil2cpp.so (???)

(GoogleSignInFragment.java:529) Fatal Exception

java.lang.Error: FATAL EXCEPTION [main]
Unity version : 2017.3.0p2
Device model : LENOVO Lenovo TB2-X30L
Device fingerprint: Lenovo/TB2-X30L/TB2-X30L:6.0.1/LenovoTB2-X30L/TB2-X30L_S000118_160831_ROW:user/release-keys
Caused by
at android.app.ActivityThread.deliverResults (ActivityThread.java:3699)
at android.app.ActivityThread.handleSendResult (ActivityThread.java:3742)
at android.app.ActivityThread.access$1400 (ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1393)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:5417)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)
Caused by: java.lang.NullPointerException:
at com.google.googlesignin.GoogleSignInFragment.onActivityResult (GoogleSignInFragment.java:529)
at android.app.Activity.dispatchActivityResult (Activity.java:6514)
at android.app.ActivityThread.deliverResults (ActivityThread.java:3695)

DllNotFoundException: native-googlesignin

I was getting the below error when I used the google signin plugin for Unity Android. I have imported the plugin multiple times but still getting DllNotFoundException.

at (wrapper managed-to-native) Google.Impl.GoogleSignInImpl:GoogleSignIn_Create (intptr)
07-04 08:50:29.338 30138 30179 E Unity : at Google.Impl.GoogleSignInImpl..ctor (Google.GoogleSignInConfiguration configuration) [0x00000] in :0
07-04 08:50:29.338 30138 30179 E Unity : at Google.GoogleSignIn.get_DefaultInstance () [0x00000] in :0
07-04 08:50:29.338 30138 30179 E Unity : at SignInSample.SigninSampleScript.OnSignIn () [0x00000] in :0
07-04 08:50:29.338 30138 30179 E Unity : at UnityEngine.Events.InvokableCall.Invoke () [0x00000] in :0
07-04 08:50:29.338 30138 30179 E Unity : at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in :0
07-04 08:50:29.338 30138 30179 E Unity : at UnityEngine.UI.Button.Press () [0x00000] in :0
07-04 08:50:29.338 30138 30179 E Unity : at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in :0
07-04 08:50:29.338 30138 30179 E Unity : at UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in :0
07-04 08:50:29.338 30138 30179 E Unity : at UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickH

ID token keeps returning expired token on Android

When I sign into google on Android, everything was working flawlessly until about an hour into testing. The google sign in keeps returning an invalid ID token which makes it impossible to validate on my backend server

Some Android devices fail to execute task callback

We're currently having an issue affecting a significant number of Android users on various devices.

Some devices simply fail to execute the callback for the SignIn function, which causes the app to be waiting indefinitely for a response from the login process. We don't have this issue on iOS and a good percentage of our Android logins succeed just fine, including my test device.

I managed to reproduce the issue using Bluestacks emulator (version 3N) on a production release of our app. It seems that the login actually succeeds, and googlesignin-native logs some details about the user, but the C# wrapper never receives any data. Here is a logfile from the failed login attempt:

06-12 15:11:26.501  3396  3396 D TokenPendingResult:  Calling onResult for callback. result: Status: Status{statusCode=SUCCESS, resolution=null} com.google.android.gms.auth.api.signin.GoogleSignInAccount@b5b33152
06-12 15:11:26.501  3396  3396 I native-googlesignin: StringFromJava Luke Zbihlyj == Luke Zbihlyj
06-12 15:11:26.501  3396  3396 I native-googlesignin: StringFromJava [valid email redacted]
06-12 15:11:26.501  3396  3396 I native-googlesignin: StringFromJava Zbihlyj == Zbihlyj
06-12 15:11:26.501  3396  3396 I native-googlesignin: StringFromJava Luke == Luke
06-12 15:11:26.501  3396  3396 I native-googlesignin: StringFromJava [valid user id redacted]
06-12 15:11:26.501  3396  3396 I native-googlesignin: StringFromJava [valid avatar redacted]
06-12 15:11:26.501  3396  3396 I native-googlesignin: StringFromJava [valid auth code redacted]
06-12 15:11:26.501  3396  3396 I native-googlesignin: User Display Name is  Luke Zbihlyj
06-12 15:11:26.555  2178  2178 D GuidanceScreen..AppLaunchReceiver: same as previous package, returning to app
...
06-12 15:11:26.589  3396  3625 W FlurryAgent: Flurry session paused for context:com.google.android.gms.auth.api.signin.internal.SignInHubActivity@786920b
06-12 15:11:26.646  3396  4075 D AudioTrack: Client defaulted notificationFrames to 756 for frameCount 2270
06-12 15:11:26.651  1658  1668 I audio_hw_primary: choose pcmC0D0p for 0
06-12 15:11:26.673  1658  1668 D AudioFlinger: mixer(0xb16171c0) throttle end: throttle time(40)
06-12 15:11:26.681  1733  2348 D ActivityManager: cleanUpApplicationRecord -- 3555
06-12 15:11:26.732  1658  1668 D AudioFlinger: mixer(0xb16171c0) throttle end: throttle time(40)
06-12 15:11:26.743  1521  1521 W SurfaceFlinger: couldn't log to binary event log: overflow.

When I execute it on my working Android device I get the following:


06-12 01:02:02.266 23097 23097 D TokenPendingResult:  Calling onResult for callback. result: Status: Status{statusCode=SUCCESS, resolution=null} com.google.android.gms.auth.api.signin.GoogleSignInAccount@f5bad294
06-12 01:02:02.266 23097 23097 I native-googlesignin: StringFromJava Luke Zbihlyj == Luke Zbihlyj
06-12 01:02:02.266 23097 23097 I native-googlesignin: StringFromJava [valid email redacted]
06-12 01:02:02.266 23097 23097 I native-googlesignin: StringFromJava Zbihlyj == Zbihlyj
06-12 01:02:02.266 23097 23097 I native-googlesignin: StringFromJava Luke == Luke
06-12 01:02:02.266 23097 23097 I native-googlesignin: StringFromJava [valid user id redacted]
06-12 01:02:02.266 23097 23097 I native-googlesignin: StringFromJava [valid avatar redacted]
06-12 01:02:02.266 23097 23097 I native-googlesignin: StringFromJava [valid auth code redacted]
06-12 01:02:02.266 23097 23097 I native-googlesignin: User Display Name is  Luke Zbihlyj
06-12 01:02:02.266 23097 23097 D Typeface: fontPath:
06-12 01:02:02.276  2680  2697 D BatteryStatsImpl: Power Add Start sensor:  sensor id 1 uid is 10189
06-12 01:02:02.306  2680  2605 D PhoneHolsterManager: int setscreenLock
06-12 01:02:02.316 23097 23186 W FlurryAgent: Flurry session paused for context:com.google.android.gms.auth.api.signin.internal.SignInHubActivity@2f2bb63
...
06-12 01:02:02.346 23097 23126 I native-googlesignin: In Wrapper display name is  Luke Zbihlyj
06-12 01:02:02.346  2680 14414 I SurfaceControl: destroy Surface com.google.android.gms/com.google.android.gms.auth.api.signin.ui.SignInActivity
06-12 01:02:02.346  2680 14414 D PhoneHolsterManager: int setscreenLock

Note the line: native-googlesignin: In Wrapper display name is Luke Zbihlyj - this doesn't get called on the emulator and I believe this is the same problem many of our users are experiencing where they never see any kind of message from us because we never receive a callback.

If anyone else is having the same issue, or any devs on this project from Google can assist in this issue it would be much appreciated.

Return Email always null

I can get displayname, photo, id. But email return always null. here is my code

			data[0] = task.Result.Email;
			data[1] = task.Result.UserId;
			data[2] = task.Result.DisplayName;
			data[3] = task.Result.ImageUrl.ToString();

			print("my data google: " +data[0] +"," +data[1]+"," +data[2]+".");
			print("link photo : " +data[3]);;

DLL Not Found Exception

I am getting this error DLL Not Found nativegooglesign in. Please help me working on this more than a day.
s1

Plugin overrides UnityAppController

Thanks for a great plugin! However, it overrides UnityAppController so for example our deep links are not coming through after adding this plugin.

Refreshing token requires a call to logout and login (a second time) to get a new token

I am not sure how this is handled with google, but here is our scenario:
Login
Get token, check with server to see if user is registered
If not
logout :(
login with forceRefreshToken set to true
Get a new token and use this to register a new user on the server

This all works, but the user has to select their gmail account twice, is there a way to get a new token without calling signout or signin a second time?

Fails to Build with Grade

Execution failed for task ':transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/nativelib/googlesignin/BuildConfig;

  • Try:

Google.GoogleSingIn+SignInException was thrown

I used only this package and the sample sign in to create a test app, i followed all the instructions (without firebase, i have setup the config in google developer account itself) and ended up with the build. When i attempt to sign in, i am redirected to select my email address and after selection i get the following error on the status screen:

'Google.GoogleSignIn+SignInException' was thrown

Also after resolving i get this warning in the editor :

Found conflicting Android library google-signin-support

Assets/Plugins/Android/google-signin-support-1.0.2 (managed by the Android Resolver) conflicts with:
Assets/Plugins/Android/google-signin-support-1.0.2.aar

Your application is unlikely to build in the current state.

any inputs ?

My config:
Android
Unity 2017.3
Sign in Master 1.0.2

Failed to fetch dependencies on Android: google-signin-support

I've created a Unity project with this plugin added, and regardless of running the sample or unpacking the unitypackage into my own project, I receive the following error when attempting to resolve dependencies on Android:

Resolution failed: Failed to fetch the following dependencies:
com.google.signin:google-signin-support:1+@aar

The project does build an APK, but running the app on the physical hardware and pressing the "Sign in with Google" button results in the following exception:

DllNotFoundException: native-googlesignin
at (wrapper managed-to-native) Google.Impl.GoogleSignInImpl:GoogleSignIn_Create (intptr)
at Google.Impl.GoogleSignInImpl..ctor (Google.GoogleSignInConfiguration configuration) [0x00000] in :0
at Google.GoogleSignIn.get_DefaultInstance () [0x00000] in :0
at LoginController.OnSignIn () [0x00000] in :0

Is there a way for me to manually resolve the dependency?
On the bright side, I've built the IOS version and can confirm the login button works beautifully.

Thanks in advance.

Error during LogIn (gives an Exception)

I have this error in the console from my android device:
Unity : Google.GoogleSignIn+SignInException: Exception of type 'Google.GoogleSignIn+SignInException' was thrown.

I have followed all the guide, and I have used web id client, and android id client and ios android client but no one seems to work!
What is the problem? why I have this issue? There is a way to get an error description more detailed?

Thanks

build problems

I really appreciate you sharing this project. This is just a request to please include the pre-built asset bundles instead of requiring the files be built.

I am one of those Unity Developers that clivehenrik mentioned in another issue. With all the dependencies and problems it's taken me many frustrating hours just to build the files. Problems have included:
sdk and ndk not found (I had to make a local.properties file including the location of the Android sdk and ndk)
I needed to install specific Android sdk and sdk tools versions
CMake license not found (took a few hours to solve: The GNU license txt file needs to be included in the sdk/licenses folder)
Java tools.jar not found (had to copy from a different Java installation)
Then I had to specify a newer ndk installation in the local.properties (was r10e, needs 12+)
Then it failed to find unity.exe (I had to change the install location in build.gradle to an existing location)
Then Execution failed for task ':inject_versionIntoMetaFiles' for google-signin-plugin_v1.0.0.txt.meta (Access was denied)
Then it couldn't copy google-signin-plugin_v1.0.0.txt.meta file from the src path to the project path (I first thought because my directory name was different to the one hard coded into build.gradle, but that didn't fix it)

At this point I was hoping the project had been built correctly, that it just hadn't been packaged into asset bundles, so I have given up on fixing build errors and copied the files from the build folder to my project.

Sign in problem

I am trying to sign in to Google with this plugin and on editor I got a "exception jni init'd androidjavaclass with null ptr" error. After reading about it, it turns out it doesn't work in unity editor. I built my application on android device and tried again, but it didn't sign in again. I don't know if that was the same error, since there's no way of checking it on an android device. I tried printing some text after certain functions and it turns out the error is somewhere in SigninSampleScript, because on signin method the status bar text "calling signin" appears, and the status bar text after GoogleSignIn.DefaultInstance.SignIn().ContinueWith(OnAuthenticationFinished) doesnt. Help!!!

Android TV screen goes black and doesn't switch back to the game after first login

This strangely doesn't happen on an Android TV emulator, only on actual devices. When I login for the first time and have to choose an account the screen just goes black afterward.

After choosing an account and closing the process the login appears to have worked upon launching the app again.

Replication Steps on Android TV:

  1. Clear data of an app that signs into google on startup.
  2. Launch the app and choose an account
  3. The signin should appear to work, but the app is now just a black screen.
  4. Close the app and launch again. It appears to be signed in

This only appears to happen on older api versions

1.0.2: Client never reaches out for auth request

I've downloaded the Unity package for 1.0.2 and set up the sample scene with my web client-id. When pressing the Sign-in button in the app, it displays "Calling Sign In" however no response is ever received, and no activity log is noted in Google to indicate a login attempt was made. No prompt is ever displayed requesting a login and password. I've followed the steps in the documentation as closely as possible. Any troubleshooting suggestions?

I always log in automatically after logging out.

I sign in automatically after SignOut () or Disconnect ().
I am logged in automatically after uninstalling and reinstalling the app.

How do I open a pop-up window to select one of my accounts?

Thank you.

configuration = new GoogleSignInConfiguration {
WebClientId = GOOGLE_WEB_ID,
ForceTokenRefresh = true,
RequestAuthCode = true
};

Building for iOS

Trying a simple google sign in for an iOS Build, cocoa pods was installed successfully, even ran it before building on Xcode, got this error on Xcode when I was trying to build

ld: warning: directory not found for option '-L/Users/Sahil/Library/Developer/Xcode/DerivedData/Unity-iPhone-dquohajfthqtuwcwbouazpxioeaj/Build/Products/ReleaseForRunning-iphoneos/GTMOAuth2'
ld: warning: directory not found for option '-L/Users/Sahil/Library/Developer/Xcode/DerivedData/Unity-iPhone-dquohajfthqtuwcwbouazpxioeaj/Build/Products/ReleaseForRunning-iphoneos/GTMSessionFetcher'
ld: warning: directory not found for option '-L/Users/Sahil/Library/Developer/Xcode/DerivedData/Unity-iPhone-dquohajfthqtuwcwbouazpxioeaj/Build/Products/ReleaseForRunning-iphoneos/GoogleToolboxForMac'
ld: library not found for -lGTMOAuth2
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Conflict with Facebook SDK

Hi, I am Using google sign in direct unity package version unity 1.0.2. Now if I include FB SDK 7.10.1 it can not be built and gives me an error of Command Invocation Failure.

Details of Error:
CommandInvokationFailure: Failed to re-package resources.
/Users/YudizSolutions/Library/Android/sdk/build-tools/27.0.2/aapt package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "/Users/YudizSolutions/Library/Android/sdk/platforms/android-27/android.jar" -F bin/resources.ap_ --extra-packages android.support.graphics.drawable.animated:android.support.v7.appcompat:android.support.v7.cardview:android.support.customtabs:com.facebook:com.facebook.android:com.google.nativelib.googlesignin:com.google.android.gms.auth.api:com.google.android.gms.auth:com.google.android.gms.base:com.google.android.gms:com.google.android.gms.tasks:android.support.coreui:android.support.coreutils:android.support.fragment:android.support.mediacompat:android.support.v4:android.support.graphics.drawable -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/animated-vector-drawable-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/cardview-v7-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/customtabs-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-wrapper-7.10.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/google-signin-support-1.0.2/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/play-services-auth-10.2.6/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/play-services-auth-base-10.2.6/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/play-services-base-10.2.6/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/play-services-basement-10.2.6/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/play-services-tasks-10.2.6/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/support-core-ui-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/support-core-utils-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/support-fragment-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/support-media-compat-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/support-v4-25.3.1/res" -S "/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/support-vector-drawable-25.3.1/res"

stderr[
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_action_mode_close_item_material.xml:17: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_action_mode_close_item_material.xml:17: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_action_mode_close_item_material.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_action_mode_close_item_material for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_alert_dialog_button_bar_material.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:scrollIndicators from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_alert_dialog_button_bar_material.xml:26: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from <android.support.v7.widget.ButtonBarLayout>
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_alert_dialog_button_bar_material.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_alert_dialog_button_bar_material for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_alert_dialog_title_material.xml:45: note: removing attribute http://schemas.android.com/apk/res/android:textAlignment from <android.support.v7.widget.DialogTitle>
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_alert_dialog_title_material.xml:36: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_alert_dialog_title_material.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_alert_dialog_title_material for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_dialog_title_material.xml:29: note: removing attribute http://schemas.android.com/apk/res/android:textAlignment from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_dialog_title_material.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_dialog_title_material for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_popup_menu_header_item_layout.xml:24: note: removing attribute http://schemas.android.com/apk/res/android:textAlignment from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_popup_menu_header_item_layout.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_popup_menu_header_item_layout for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_popup_menu_item_layout.xml:59: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_popup_menu_item_layout.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_popup_menu_item_layout for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_screen_toolbar.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:touchscreenBlocksFocus from <android.support.v7.widget.ActionBarContainer>
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_screen_toolbar.xml: note: using v21 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_screen_toolbar for configuration v21.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_search_view.xml:47: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_search_view.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_search_view for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_select_dialog_material.xml:23: note: removing attribute http://schemas.android.com/apk/res/android:textAlignment from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/abc_select_dialog_material.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/abc_select_dialog_material for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_device_auth_dialog_fragment.xml:80: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_device_auth_dialog_fragment.xml:80: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_device_auth_dialog_fragment.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/com_facebook_device_auth_dialog_fragment for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_smart_device_dialog_fragment.xml:94: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_smart_device_dialog_fragment.xml:94: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_smart_device_dialog_fragment.xml:83: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_smart_device_dialog_fragment.xml:83: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_smart_device_dialog_fragment.xml:47: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <android.support.v7.widget.AppCompatImageView>
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/facebook-android-sdk-4.23.0/res/layout/com_facebook_smart_device_dialog_fragment.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/com_facebook_smart_device_dialog_fragment for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/notification_action.xml:17: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/notification_action.xml:32: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/notification_action.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/notification_action for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/notification_action_tombstone.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/notification_action_tombstone.xml:37: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout/notification_action_tombstone.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/notification_action_tombstone for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media.xml:42: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media.xml:34: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media.xml:34: note: removing attribute http://schemas.android.com/apk/res/android:layout_toStartOf from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentEnd from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media.xml: note: using v17 attributes; synthesizing resource com.yudiz.authdemo:layout/notification_template_big_media for configuration v17.
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media_custom.xml:89: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media_custom.xml:34: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media_custom.xml:34: note: removing attribute http://schemas.android.com/apk/res/android:layout_toStartOf from
/Users/YudizSolutions/Documents/Projects/GoogleSignIn(1.0.2) 2/Temp/StagingArea/android-libraries/appcompat-v7-25.3.1/res/layout-v11/notification_template_big_media_custom.xml:56: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from

Can't use with Facebook SDK

Can't use google-signin-unity with Facebook SDK. After Facebook sign in, browser shows blank(white) screen and nothing happens.

Steps to reproduce:

  1. Create a new unity project, add facebook sdk from https://developers.facebook.com/docs/unity/downloads/ using version 7.10.1;
  2. Implement sign in with facebook;
  3. Add google-signin-unity to unity project;
  4. Build xcode project for iOS;
  5. Build app, open it, try to sign in with Facebook. After sign in, browser shows blank(white) screen and nothing happens.

If I delete /Assets/Plugins/iOS/GoogleSignIn/GoogleSignInAppController.* from my unity project, Facebook auth works correctly.

Tried with unity 5.5.2, 5.6.4;
play-services-resolver v1.2.59.0.

'System.AggregateException' Android build

Hi guys

I'm having trouble logging in with Google (using Firebase) only with android. When I try to login, the task returns me this error 'Exception of type' System.AggregateException 'was thrown.' In iOS everything works normal.

Can someone give me a light and point out the possible problem that is happening?

Thank's :)

Signin not supported in editor

Sign in works on iOS, but with no support to have it working in the Unity editor, it makes testing and workflow tremendously difficult. Is there any workaround for this?

Prebuild with Gradle: Could not find google-signin-support.jar

I'm not sure if this is an issue with Play Services Resolver or Google Sign In but I suspect it may have something to do with the recent change from arr to srcarr.

When I tried to prebuild with Gradle from Play Services Resolver I got the following error:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'GenGradle'.

Could not find google-signin-support.jar (com.google.signin:google-signin-support:1.0.2).
Searched in the following locations:
file:/D:/Unity/Project/Temp/GenGradle/m2repository/com/google/signin/google-signin-support/1.0.2/google-signin-support-1.0.2.jar

Can you suggest a solution?

DeveloperError Exception of type 'Google.GoogleSignIn+SignInException' was thrown.

Hi there!

I was following the guide and found something different.

"This file contains the client-side information needed to use Google Sign-in. The details on how to do this are documented on the Developer website."

I entered SHA1 and the package and created a json file by clicking 'Configure a Project' through the developer website link, but the file looks different from the guide.

image

Is it wrong to choose Android from the image above?

My json file looks like this:
{"installed":{"client_id":"529939461761-1809034pngb3o70tgnlupamab0e1l8vs.apps.googleusercontent.com","project_id":"myproject-492d7","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}

Sample project not working anymore

Since last few days, the unity google sign in sample is not working anymore. It did work earlier however now it throws DeveloperError with 'Google.GoogleSignIn+SignInException'. Please help.

Configuration file looks totally different

My configuration file looks like this:

{"web":{"client_id":"56219440xxxxx-xxxxxx.apps.googleusercontent.com","project_id":"xxxxxx","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"xxxxx"}}

This is completely different than the one in the documentation. Do I miss something here?

Can't build latest plugin (Windows 10, Unity 2017.3)

The latest code seems to build fine but always fails when trying to copy files. I have verified all files exist and are accessible. If I run with stacktrace enabled it shows a FileNotFoundException with (Access Denied). However, the file does in fact exist and is readable.

FAILURE: Build failed with an exception.

  • Where:
    Build file 'E:\GoogleUnity\build.gradle' line: 98

  • What went wrong:
    Execution failed for task ':copy_unity_project'.

Could not copy file 'E:\GoogleUnity\GoogleSignInPlugin\Assets\GoogleSignIn\Editor\google-signin-plugin_v1.0.0.txt.meta' to 'E:\GoogleUnity\build\GoogleSignInPlugin\Assets\GoogleSignIn\Editor\google-signin-plugin_v1.0.0.txt.meta'.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.598 secs

Back button on Android treated as IsFaulted instead of IsCanceled

I have tried on integrating the plugin with my existing cross-platform (Android/iOS) Unity project. I found that after getting into the overlay for choosing Google account on Android device, if I press the device's back button, or somewhere outside the accounts list box, I will be caught by the case of "task.IsFaulted" in Unity's script, instead of "task.IsCanceled" one.

I tried a similar action on iOS by clicking the "Done" button of the redirected browser window, I was successfully caught by the "task.IsCanceled" which I can have some different UI behaviour then.

I have checked the error status code returned on Android side, but it was just a general type "Error" returned, instead of any other understandable types such as "Canceled" or "Interrupted". I cannot just think in the way that error type "Error" would be same as "user cancelation" since the comments in the definition script stated that it is for some kind of error with no further details.

I guess it is not the expected behaviour by the developers because "task.IsCanceled" is triggered in same case, but in an Android native project. Thanks in advance.

Got Error: DeveloperError Exception of type 'Google.GoogleSignIn+SignInException' was thrown.

I've run into this error while using the example scene as directed in the ReadMe. Unlike outcomes other users have reported before, I'm 99% certain the issue isn't related to the spelling of the webClientID string (process thus far detailed below) so I was wondering what else it could possibly be.

Here's a list of the things I've triple-checked:

  • Created an API key and web application OAuth 2.0 client ID on Google Cloud Platform and enabled the required APIs.
  • webClientID string in the SignInSampleScript scene; I copied/pasted the client_ID where the client_type is '3' directly from the google-services.json file, which was downloaded from the 'API & Settings' -> 'Credentials' page on Google Cloud Platform. I've also set up a Debug.Log to ensure its carried through correctly to the OnSignIn function (one user reported Unity was defaulting this string to its initial value)
  • The package_name from the same file where client_type is '1'. This is copied and pasted into Unity's player settings and also on the OAuth 2.0 entry in Credentials page of 'API & Settings' page of Google Cloud Platform.
  • The keystore file, key alias and their passwords are present in Unity's player settings. We aren't using debug.keystore and have created our own keystore file.
  • The SHA-1 fingerprint has been copied using the [keytool -exportcert -list -v -alias -keystore ] console command successfully and I've pasted it into the OAuth 2.0 entry in 'API & Settings' -> 'Credentials' page on Google Cloud Platform.
  • I've run AndroidResolver from the Unity -> Assets -> Play Services Resolver menu after each change, just to ensure up-to-dated-ness.

I managed to log each of the GoogleSignInStatusCode enum flag states returned with the GoogleSignIn.SignInException task and the results look like this:

  • Error.Status.Flag[Success] Is it this? [True]
  • Error.Status.Flag[ApiNotConnected] Is it this? [False]
  • Error.Status.Flag[Canceled] Is it this? [True]
  • Error.Status.Flag[Interrupted] Is it this? [False]
  • Error.Status.Flag[InvalidAccount] Is it this? [True]
  • Error.Status.Flag[Timeout] Is it this? [False]
  • Error.Status.Flag[DeveloperError] Is it this? [True]
  • Error.Status.Flag[InternalError] Is it this? [False]
  • Error.Status.Flag[NetworkError] Is it this? [False]
  • Error.Status.Flag[Error] Is it this? [False]

According to the parameter summarys and remarks in GoogleSignInConfiguration.cs:

  • Success = "The operation was successful"
  • Canceled = "The result was canceled either due to client disconnect or cancel()"
  • InvalidAccount = "The client attempted to connect to the service with an invalid account name specified."
  • DeveloperError = "The application is misconfigured. This error is not recoverable. The developer should look at the logs after this to determine more actionable information."

I'm not too sure what to make of these results (succeeded and cancelled are both true and it threw an error?). It appears I can specify an AccountName parameter for GoogleSignInConfiguration (null uses the 'default'), what format could that take?

Also, the remarks for DeveloperError mention more information being in the logs. I found the line:

  • TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: INVALID_AUDIENCE

Apparently this is a pretty common error and relates to some misconfiguration of the client ID settings. According to Mengcheng Duan back in 2014:

"Invalid audience means either your Android app is not registered in Google cloud console or it is registered in a different project other than the one where the server client_id lives.
The 403 is caused by the browser API key referer restrictions. Currently the workaround is to create a new browser/android API key without referer/package restrictions."

I've tried creating new client IDs several times with different settings and to no avail. Any help would be greatly appreciated in the mean time if the answer is clear! :)

Edit: After a lot of trial and error, the problem has been solved and it seemed to be something no one has pointed to yet. The action that switched it from not working to working was signing up as a Play developer (registration fee included) to gain access to the Google Play Console, and then seemingly creating an OAuth client under 'API Access' (its a big button, can't miss it). It makes sense I suppose, but it's strange that it hasn't been mentioned anywhere else in the documentation. Hopefully this report can act as a guide if anyone else ends up in a similar position.

Unity Package - In Releases

Hey, can't seem to find the unity package mentioned in the guide. so tried running gradlew build_all returns an error saying 'SDK Location not found'.
so i just copy pasted the files onto unity,
followed some instructions in another issue thread.
I ended up building the application but it would return an error when i tried to install it which would say 'Could not parse package'

any suggestions ?

im using Unity 2017.3 and the latest version of this repo and Firebase

Sample scene stop operating

In IOS mobile, Whenever I push any buttons related to sign in, the app stops without any log. The button I pushed is in the pushed state and I cannot do anything except terminating it.

Do you know why it is??

Got Error: DeveloperError Exception of type 'Google.GoogleSignIn+SignInException'

I have only used this plugin with sample package. I've setup firebase account too. I tried building the apk without firebase and provided web client id as well. Now when i try to sign in, i get following error in status text:
Got Error: DeveloperError Exception of type 'Google.GoogleSignIn+SignInException' was thrown
Pls note that it worked twice just by selecting resolving client jars from menu. After that it again stopped working after making few changes, since then i'm not able to make it work.

You get Unable to convert classes into dex format.

CommandInvokationFailure: Unable to convert classes into dex format.
/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/chenrick/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment$3;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment$State;
Uncaught translation error: java.lang.IllegalArgumentException:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.