Authenticate with Google in a signed Android App - android

I'm trying to create an android app that authenticates with Google account.
After hours of struggling I see that when I remove the Signing from my android app, the Google authentication works perfectly; instead, when I Sign the application, suddenly it gives me an "Internal Error", hence I cannot authenticate with Google account.
For a better comprehension:
I Sign the app as below following Android Developers Steps.
With the signed App, the authentication with Google doesn't work.
If I remove the config that describes the Signin than I can normally authenticate with Google account, otherwise it's simply an internal error as follows:
I'm a complete newbie in android programming, so I'm asking here if anyone has some reference or input to give me in order that I can understand the problem and what to look for (I've been searching in the web but still now nothing matches my problem).
Thanks!

Are you using release google-services.json ? It should contain your release certificate SHA-1.
Probably you're using debug certificate SHA-1, if that's the case, it will only work with debug signed apps. For release signed apps you should generate again google-services.json with the appropiate SHA-1.

Related

Android Is it possible to test Signed App (Staging App) without the verification is done through oAUTH?

We are integrating GoogleFit in our existing application. We were able to test in Debug mode. But when we are trying to test using Signed Version of the App (Staging) Google oAuth is not letting to proceed. Its returning RESULT_CANCELED.
Is it because we have not done the oAuth Verification yet?
it all comes to the fact SH1 was changed and google can't verify you anymore add your new SH1 generated by your StoreKey this should work
After sometime figured out. It turned out, for externalTest (Staging Build) We were using different sha1 fingerprint. Different than the production one (You have the signing SHA1 from Google Play Store Console) After i entered the new Sha1, everything works fine as expected.

Invalid Key Hash Facebook, The key hash provided in setting is correct

We are stuck at this point. We are already using the signed APK by installing in multiple devices without any problem, and we've also provided the required key hash in developers.facebook.com which created using the release keystore.
But today we've released the app in google play beta testing, and now after downloading from google play and going to facebook login gives me an error Invalid Key Hash with some key hash value which completely new to me. Different than the key hash we created using the release keystore which we've used to sign the APK.
We are thinking that it might have something to do with the Release Management -> App Signing process which someone else has did something in it, but not sure.
We are already using the apps which have facebook login in google play store production which are working fine but this.
What else need to be done in case of App Signing?
Any help will be greatly appreciated.
#Dhanumjay, it's fixed now. Thanks to this answer. I also tried to write it down simply from the error message but it didn't work somehow(as it's hard to read, sometimes you may end up typing it wrong)
I don't know the exact issue what happening after app signing. I'm also faced the same issue like this for one of my app. Suppose if you are still facing the keyHash issue, simply write down the error keyHash which is showing and paste that keyhash to developers.facebook.com then your problem will be solved.
I know this problem.
Because, if facebook App installed, we show invalid key-hash.
Because different hash key web and facebook App.
So, you input code (this code is android java)
facebookloginbutton.setLoginBehavior(LoginBehavior.WEB_ONLY);
setLoginBehavior(Web.only)
you can show another option facebook developer site.
In case someone is still facing this in 2021, with the updated Play console, go to "App Integrity" menu, there you'll find "Play App Signing", if it's shown as "enabled", this means your app was signed by Google not your own release key. Copy the keys shown then follow #KunalK answer above. Side note, this also works for services like Google Sign in, which require the SHA-1 and SHA-256 keys.

Game Services OAuth2.0 error when testing release SHA-1 authorisation

I am been trying to set up my game for google play game services. So far I have managed to get a debug SHA-1 authorization to work and sign into the services in my game. Although, I cannot manage to get the release SHA-1 authorization to work. When I tap the sign in button in my app I get the usual sign in and select account options after this screen;
but once you select your account and it loads it up I get this error message
and the sign in was unsuccessful.
I have tried almost everything but I don't know what I am doing incorrectly. I have both client ID's correctly entered and linked to the developer console. I am also using firebase in my app if that changes anything. Any help would be appreciated. I can't seem to find this error code anywhere either.
You may want to check the suggestion in this thread: Can't authenticate users, sign in fails
Go to https://console.developers.google.com/ and then choose API manager from menu.
Then go to credentials of your app (if your app isn't there yet you should add it using the search).
When you're in credentials of your app just replace SHA-1 certificate line with the one that shown in your App signing (it's in Release management menu of Google Play Console).
There you'll see app signing certificate info, you need that SHA-1 line from there, then you just replace the one you have in credentials with that one.
Also, based from this documentation, if you are unable to sign players into your game, first make sure that you have followed the instructions to create your client IDs and configure the games services. If you still encounter sign-in errors, check the following items to make sure that your game is set up correctly.
Check your metadata tags
Check your package name
Check the certificate fingerprint
Check that test accounts are enabled
Hope this helps!

Android - get APK certificate of last release

I've got a project to do- I got an app and I have some changes to do on that.
The app already been uploaded as a beta version to the Google play developer console,
Now I try to upload a new apk with some changes I made so I sign the APK with my own certificate, well it's says the APK must be signed with the last certificate,
Therefore- I want to know if there is somehow to get the last certificate and sign it by myself or should I ask from the last programmer the certificate that he has been used?
i want to know if there is somehow to get the last certificate and sign it by myself or should i ask from the last programmer the certificate that he has been used?
You answered yourself pretty much here. If you do not have last certificate then you need to ask for it the one who has it, or you must change packageId (thus making it a new app) and then release as new app in to Google Play.
This is related read in official docs: https://developer.android.com/studio/publish/app-signing.html

Google Play Services - Sign in - Client ID debug vs release

After properly implementing Google Play Services in my first game now it is time for the second.
I'm stuck on message "There is no linked app associated with this client ID” .....
I have properly configured things for debug and release. When i run app from Eclipse it works ( debug key is used and i can sign in ).
When i create a signed apk and install it on device i get "There is no linked app associated with this client ID”.
In Google API I have 2 client IDs ( debug and release , also tried to remove one of them - no luck )
I Have tried adding / removing testing accounts ;/
I have created beta test, pushed game to Google Play and marked as beta. Then installed it from the store as "beta tester"
I checked also SHA1 values and are set properly. META-INF/CERT.rsa show the same SHA as release in Google API
This is an update not a new apk, game service are published because they are working fine in debug mode.
It's a paid app.
After this I have tried to create second linked app with the same package name. It is not working still and now i cannot delete that second linked app :/
It's a mess I know but what else this can be ?
I cannot sign in....
EDIT: I resolved following the Google Note. LOL
Note: If you are debugging your game using your debug certificate but have configured game services using your release certificate, you should add a second linked app using the same package name and your debug certificate's SHA1 fingerprint. This will allow you to sign in to the application whether it's signed with the debug or release certificates.
Google Services Developers Link
"a second linked app" is the key point, not two game, but two linked app in the same game
So, the right method is to link two time the same app in the Google Play Developer Console:
First app with bundle com.name.appname and release fingerprint
And a second app, with the same bundle and another name (es. AppName Test User1) and with debug fingerprint
In this way, in the Api Developer Console, it creates two OAuth2 client ID for the same project and both work well.
NOTE: If you have done many tests, remember to delete all app in the play games section of Google Play Developer Console, and all projects in the Api Developer Console.
The accepted answer above is correct, but the Play Store now uses Google Play App Signing, which will replace the key you use to create the signed apk with a different one. So, if you continue to run into trouble (like I did), this might be the issue.
I found the answer here, but will paraphrase. Basically, follow all the steps above, but you need to use the key used by the Play Store. Go to the Google Play Console and select the app you are working on. Click on 'Release Management' and then 'App Signing' on the left side menu. There you will see both a "App signing certificate" and an "Upload certificate". You need to use the SHA-1 fingerprint from the "App signing certificate" in order for the 0auth2 client ID to work.
Two services (games) must be created:
For debug certificate's SHA1 fingerprint.
For release certificate's SHA1 fingerprint.
If the game is published, you can not create a second linked application with the other SHA.

Categories

Resources