3

I have a simple application written in Android, where I want to do Google Sign and then Firebase Authentication. I copy paste the code from official page.

val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build() if (requestCode == REQUEST_CODE_GOOGLE_SIGN_IN) { val task = GoogleSignIn.getSignedInAccountFromIntent(data) try { // Google Sign In was successful, authenticate with Firebase val account = task.getResult(ApiException::class.java) firebaseAuthWithGoogle(account.idToken!!) } catch (e: ApiException) { // Google Sign In failed, update UI appropriately Log.w("aaa", "Google sign in failed", e) // ... } } 

But this simple code is throwing an exception com.google.android.gms.common.api.ApiException: 12500:

What is an issue, I checked online sources everyone is saying add support email, add application icon, but to add application icon I need to go through the OAuth verification process, which asks a lot of data which I currently do not have as I just started to develop my application, please help I am trying to solve this issue already for 48 hours.

6
  • I think it's a duplicate of this question: stackoverflow.com/questions/64587610/… Commented Oct 29, 2020 at 8:49
  • @gildor I think you posted the wrong link Commented Oct 29, 2020 at 8:51
  • @ViktorApoyan I think this answer will help. Commented Oct 29, 2020 at 10:38
  • @AlexMamo but my question would be, why the app is not working when I am deploying it from the Android Studio? because at least it was working before I uploaded it to play store Commented Oct 29, 2020 at 11:00
  • Sorry, this is correct link - stackoverflow.com/questions/47632035/google-sign-in-error-12500 Commented Oct 30, 2020 at 9:04

1 Answer 1

5

because at least it was working before I uploaded it to play store

Problem (a feature called Play App Signing)

It seems like the Google Play Store is signing your app instead of you, so Firebase detects a different signing key, and prevents authentication. Re-signing apps is a Google Play Store feature, and preventing apps signed by signing keys which you haven't verified from authenticating with Firebase is a Firebase feature.

Solution

Go to Google Play Store Console → Setup → App Signing → App signing key certificate, copy the SHA-1 certificate fingerprint.

Then go to Firebase Console → Project Settings → Your Apps → Add Fingerprint → and paste the SHA1.

What you are doing

Telling Firebase to accept authentication requests generated from an app signed by the key handled by Google Play Store. It previously only accepted requests from an app signed by your locally signed app, where the key is stored on your computer.

Copy SHA-1 from here:

Play Console screenshot

Paste SHA-1 as a fingerprint here:

enter image description here

Sign up to request clarification or add additional context in comments.

8 Comments

I just realised, because these are fingerprints, revealing the numbers in my screenshot won't matter in terms of security, so I didn't need to hide them.
Hey, @Ben I will try the suggested solution today and let you know if it works or not, but I already did that and it doesn't work, also I think you forgot to mention that I need to download a new google-service.json file. or it is not required?
Hey @ViktorApoyan, I forgot about that as I haven't done this in a while :D. It's probably better if you update that file, as it does contain the fingerprints. Not sure if the google services plugin will actually use it, so you could first try without updating this file, and see if it works.
I would expect the signature is validated on the server side, not from the Google services json file. However, there might be initial validation on client side.
WOW-took me 3 days to figure this out. Tried 20 other things - but this was the answer. Menu item is now changed from "App Signing" to "App Integrity"
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.