googlesamples / google-signin-unity

Google Sign-In API plugin for Unity game engine. Works with Android and iOS.
Other
424 stars 229 forks source link

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

Open Ryu17 opened 6 years ago

Ryu17 commented 6 years ago

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"]}}

Ryu17 commented 6 years ago

OK, I tried to solve this problem all day and finally solved it.

The above question was not wrong. The 'Google Sign-In configuration file' section in README.md is probably a file obtained through firebase. It looks different, but it is not wrong.

https://developers.google.com/identity/sign-in/android/start Click the CONFIGURE A PROJECT button on this link, select the project, set it to Android, and enter the Package Name and SHA1. (You need to get into the Player Settings in the Unity Editor, set the Keystore in the Publishing Settings and get the SHA1 value.)

Next, when you click the GOOGLE API CONSOLE button in the above link, there will be two kinds of OAUTH 2.0 CLIENT IDs in the project. image The CLIENT ID we need is 'Web client (Auto-created for Google Sign-in)'. Enter this CLIENT ID into the webClientId of SigninSampleScript.cs.

Finally, browse keystore in Publishing Settings and build with release. (You should never do Developer Build, I spent a lot of time here.)

I hope this will help you .

toom1984 commented 6 years ago

thanks! helped to clear up stuff for me

torresalmonte commented 6 years ago

Thank you!, you saved the day! This was a very tricky situation.

nphausg commented 5 years ago

Agree with Toom, if you need an official guideline, please check here https://github.com/googlesamples/google-signin-unity

screen shot 2019-01-03 at 10 48 40 pm
bipinGosain commented 5 years ago

Still getting this issue. I've cross-checked all of the above. Any other suggestion?

I'm using: a. Unity 2018.1.5f1 b. firebase_unity_sdk_6.2.0 c. google-signin-plugin-1.0.4

Steps:

  1. Setup a Unity App on Firebase.

  2. Imported both the plugin along with Sample Google Script.

  3. I'm using Google Sample's Sign In script.

  4. Added a SHA-1 fingerprint from C:\Users\user.android\debug.keystore, to Firebase console.

  5. Downloaded and added googleservices.json to root of the Assets folder.

  6. Used the id from google-services.json OAuth client type 3 to the WebClient ID.

  7. Always getting Google Sign In Exception NOTE: No third part modules added, just Unity Ads.

Mukikaizoku commented 5 years ago

@Ryu17 Thank you, that information was helpful! I wish that was in the ReadMe

@bipinGosain I'm not 100% certain, but it seems that using a debug.keystore doesn't work. I had to use the release keystore that I use for my app.

Also, it if you can check if that SignInException has Status=Error vs DeveloperError, that may help figure out what is wrong.

bitCoder0 commented 4 years ago

I had this problem recently, hope this note helps someone! before telling my problem solution, something that you should check are steps mentioned in the @bipinGosain answer:

Still getting this issue. I've cross-checked all of the above. Any other suggestions?

I'm using: a. Unity 2018.1.5f1 b. firebase_unity_sdk_6.2.0 c. google-signin-plugin-1.0.4

Steps:

  1. Setup a Unity App on Firebase.
  2. Imported both the plugin along with Sample Google Script.
  3. I'm using Google Sample's Sign In script.
  4. Added a SHA-1 fingerprint from C:\Users\user.android\debug.keystore, to Firebase console.
  5. Downloaded and added googleservices.json to the root of the Assets folder.
  6. Used the id from google-services.json OAuth client type 3 to the WebClient ID.
  7. Always getting Google Sign In Exception NOTE: No third part modules added, just Unity Ads.

and remember to do a release build not debug(just in case) the key in the json file works but for me id of key type 3 is the secound part of "oauth_client" part in google-services.json for example: you should copy bbbbYOURID.apps.googleusercontent.com part of json file not aaaaYOURID.app..: my mistake was copying the client id of type 1 not 3

    "oauth_client": [
        {
          "client_id": "aaaaYOURID.apps.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.game.game",
            "certificate_hash": "2a6d7cc8a7423fa3c11b8577ff53812e6cf13f6e"
          }
        },
        {
          "client_id": "bbbbYOURID.apps.googleusercontent.com",
          "client_type": 3
        }
      ],

except json file,you can access that id by this way: go to firebase console>authentication>secound tab(sign in method)>expand the google section>expand the "Web SDK configuration" part>copy the WebClient id the key worked for me, without making a new key in firebase cloud page or without using the oauth key in the JSON file image

image

Alej-P commented 3 years ago

I was getting this error on Android (not iOS) and I just solved it after spending a couple of days on it. Things to check:

bhanumadhavsharma commented 3 years ago

I was getting this error on Android (not iOS) and I just solved it after spending a couple of days on it. Things to check:

  • the clientID you use in your Unity code is the WEB client ID but there needs to be an Android client created with the same account, referencing the correct app bundle id and SHA1 of the Release keystore. The Android Client ID is not used but the Android plugin seems to check that a valid Android client exists.
  • make sure you sign in with the Release keystore (I was using jenkins so I had to make a test Google Play release because all other local builds were throwing this error)

How did you get the Release keystore?

Is this a separate command from the debug keystore? The command I used for the debug.keystore was "keytool -list -v -keystore C:\Users\username.android\debug.keystore -alias androiddebugkey -storepass android -keypass android".

Or am I misunderstanding and you have to release the app on the play store in order to acquire that keystore?

nforcen commented 3 years ago

It is strange for me, if I export apk, everything works Okay. On the other hand, if I create the .aab version and upload it to GooglePlay, I have this error. What could I do wrong?

BlissGDev commented 2 years ago

Hi, It's happening the same to me.

I have the setup as follows: -Android, iOS and Web keys configured. -Added the correct SHA-1 string into the Android Key -Added to the Unity Project the Web Id and pasted the configuration from Play Console -Build with release keys -Added accounts to testers on the Cloud Console Platform

I got It working on iOS (adding the GoogleServices-Info.plist and adding the client id to URL schemes) but It doesn't seem to work in Android. I keep having the same error: DeveloperError Exception of type 'Google.GoogleSignIn+SignInException'

Any suggestion on what I might be missing ?

bontanksakti84 commented 2 years ago

you save my life and time bro...thank you

LangInteger commented 1 year ago

For anyone gets here after 2021, if you are signing your app with Play App Signing, you should also add SHA-1/SHA-256 generated by GP:

image

to your firebase console:

image

PokerNinja commented 1 year ago

For anyone gets here after 2021, if you are signing your app with Play App Signing, you should also add SHA-1/SHA-256 generated by GP:

image

to your firebase console:

image

Took me days. Now it's working! Thank you Thank you Thank you!!!!

okaydeep commented 1 year ago

For anyone gets here after 2021, if you are signing your app with Play App Signing, you should also add SHA-1/SHA-256 generated by GP:

image

to your firebase console:

image

It's work for me,

My situation is: Local build apk -> works Downloaded from google play beta test -> not working, throw exception

Just follow above steps, no need re building, then succeeded!

Thank you!!

Surakshaajith commented 9 months ago

I am not making use of firebase and i still encounter the same error in my untiy build. unity - Got Error: DeveloperError Exception of type 'Google.googlesignin+SignInexception' was thrown

Local build apk works fine when downloaded from google play open testing of aab file -> not working, throws above exception Even though i do not use firebase for my project, i checked the aab file in firebase test lab, it runs without any error. What might be the reason?