Play-games-plugin-for-unity: Authentication always fails

Created on 29 Jun 2017  路  32Comments  路  Source: playgameservices/play-games-plugin-for-unity

###I follow guide.
My app shows green dialog but Authentication may be faild and 'test' scene loading dose not happen
though I registered my gmail in play console tester.
capture

first init code
capture2

and auth code
capture3

what is the problem?

sorry for my bad english

thank you for reading

Most helpful comment

@leehotae

Listen carefully. Copy SHA-1 from "Upload certificate", not "App signing certificate".

Now it works fine!

All 32 comments

I'm having the same problem here. This problem is due to new updates on Google Play Console.

@wismax

thanks for reply

Do you find any solution?

Same problem. Anyone has an ETA of the fix?

@leehotae
I found the solution here
It works successfully

@wixmax

thank you
but I think it did not work for me

In my case
default setting capture
capture1
capture2

In your link
He says default sha1 in credential is upload certificate sha1 (2D:E3:15:F4:F2:5A...) and replace with app certificate sha1 (62:4E:D0:B7:8E...)

but in my case
default sha1 in credential is equal to app certificate sha1

Is it right for my understanding your link article?

It didn't help me too.
App is still trying to log in, but nothing happens.

@interpol-kun

Is your default sha1 in credential equal to app certificate sha1?

@leehotae

Yes, it is. I have attempting-login-window like you showed on the 1st screenshot, but there is no top pop-up gravity of successfull login, and Social.ShowAchievementsUI() doesn't work as well.

UPD:
That test piece of code shows me, that login is always failing.
default

@leehotae

Listen carefully. Copy SHA-1 from "Upload certificate", not "App signing certificate".

Now it works fine!

@leehotae
Yes, as he said @interpol-kun
Replace SHA-1 in https://console.developers.google.com/ with this

933

@interpol-kun
thank you
it works fine too

@wixmax
thank you
it works fine too

Change your SHA1 and
Create your APK with .Keystore. If you dont use .keystore login not success.

Problem is, you copied your application's SHA-1 key to your API credentials. You need the upload certification SHA-1 key instead.

Not working here. Same problem.
My SHA-1 is right.
It's the good "upload certification SHA-1" from the google play console, that I can find, already well written, on the API console with the good App ID and package name.

When I build directly from Unity to my phone, the login to Google Play Games works.
But when I download the game from the Closed Beta Play Store, the login always fails.

I really don't know where to look after now to correct this.

Yes, thank you, I'm putting here too my screenshot because the screenshot in korean, that we can see
above, is WRONG (for me) (or maybe because it's in Korean I can't see it's upside down and I've been tricked)

keystoresolution

I am having the same problem. When I linked my app It had App signing SHA1 in API manager by default. Then the app was trying to sign in but failing every time. I replaced Upload Certificate with App Signing Certificate, now even signing in screen doesn't pop up.

One more question, are you guys using API key feature from API manager(the option above OAuth 2.0 client ID)?

@interpol-kun said Listen carefully. Copy SHA-1 from "Upload certificate", not "App signing certificate".
Thanks buddy, it helped me and I got it fixed!

Doesn't work to me. I replaced both "App signing certificate" and "Upload certificate", still always fails.

Actually putting upload certificate into credentials works for an uploaded version.

This helped me.

https://github.com/playgameservices/play-games-plugin-for-unity/issues/2217#issuecomment-417619382

Can confirm this works:
open template-AndroidManifest.txt
"\ APP_ID" to "\u003__APP_ID__"
setup GPGS from Unity (press Window/Google Play Services/Setup)

True, after the correction, I received the error "Authentification failed". But it was a problem with SHA-1. It was decided when I did
keytool -exportcert -keystore user.keystore -list -v
And put the correct SHA-1 in https://console.developers.google.com/apis/credentials in the application settings.

Does it mean that in:
Google Play Console > Game services > My application > Linked apps,
deleting the Android app authorized with the old OAuth2 Client ID (App signing certificate),
and then adding a new Android app authorized with the new OAuth2 Client ID (Upload certificate)?

I still cannot fix it after that. Anyone helps?

I tested both Upload certificate and app signing certificate and with both of them, I can not sign in.
My app sha1 (keystore) is the same as upload certificate. I changed sha1 in console.developers.google.com to Upload certificate sha1 and app signing certificate sha1.

I tried "Upload Certificate" previously and able to authenticate, but it's failed after few install. My final solution is to have both "Upload Certificate" and "App Signing Certificate" sha-1 in the google console and it's working fine now

Under your Linked Apps section in Google Play Console -> Game Services you need to add 2 apps, 1 for production (the one that gets released via Google Play) and use the "App Signing" SHA-1,
and the second app is for testing (where you build directly to your phone) and for that one use the "Upload Certificate" SHA-1.

Under your Linked Apps section in Google Play Console -> Game Services you need to add 2 apps, 1 for production (the one that gets released via Google Play) and use the "App Signing" SHA-1,
and the second app is for testing (where you build directly to your phone) and for that one use the "Upload Certificate" SHA-1.

This should be mentioned on the setup instructions. Worked for me. Not sure yet if it had any side effects.

Social.localUser.Authenticate was working fine for me.

However, since the last couple of days, it has suddenly stopped working (authentication failing). I didn't change anything at all. Is someone else also experiencing the same issue?

Same Problem here, @arsalankhanji, have you found what the fix is?

hello I was having this issue last 3 days and I found the solution.
so if you are downloading the app from google play use the signin sha1. if not use the uploading sha1.
and the thing that you shouldn't ignore is to update the oauth consent screen

update one of those fileds and hit save and boom the google play services works :wink:

I had a simillar problem, when I was using Saved Games. My problem was that I didn't tell Google Services that I want to use Saved Games. Solution was to find this option "Saved Games" (or something like that) in Google Services in Google Play Developer Console.

Taken from Cross Platform Native Plugins
But, the info here is very general and works with any plugins.

Why sign in fails?

For Google Play Services to sign in successfully, you need to make sure the apk from where you are logging in should be allowed to make requests to google servers.

How to make the APK authorized to make requests to google servers?

Each apk built with a keystore has a SHA fingerprint. You need to make sure the SHA fingerprint is added in the google cloud.

You can fetch it with keytool command (check聽here聽on how to get SHA for each environment )

How many SHA fingerprints I need to add for successful authentication?

One per each environment. In total 3 environments (dev, release and production)

  1. Development build uses android default debug keystore.
  1. Release build uses the keystore you set in publishing settings of player settings

  2. Google play store build which uses google play signing.

If you want all the above builds to authenticate successfully, add all 3 fingerprints. Else only the required environment.

How to get each environment's SHA?

  1. Debug ( keytool -list -v -keystore "PATH_TO_DEBUG_KEYSTORE" -alias androiddebugkey -storepass android -keypass android)

  2. Release (Get from Google play console -> Your App -> Setup -> App signing -> Upload key certificate )

  3. Apk/AAb downloaded from Google play store (Get from Google play console -> Your App -> Setup -> App signing -> App signing key certificate )

Where to add these SHA fingerprints?

Google Play Console. Check聽here聽for details on how to add a SHA fingerprint.

Why it fails only when Saved Games is on?

This is because one of the following reasons

  1. Saved games feature is not ON in Google Play Console
  2. You are not listed as a tester in Google play console

How to enable Saved Games?

  1. Navigate to your app in Google play console
  2. Select Play Game Services section on left side bar under Grow
  3. In Setup and Management, select configuration
  4. Click on Edit Properties
  5. Set Saved Games to On
  6. Click on Save Changes
Was this page helpful?
0 / 5 - 0 ratings