12500, an Android Developer’s nightmare…...

Written by Abderraouf GATTAL. You should follow him on Twitter.


Debugging the 12500 Google Sign-in authentication error…

Image for post

I was Developing and Android App which provides sign-in with both Facebook and Google using Firebase Authentication services, So i started coding and covered everything the documentation recommended. After finishing everything I was optimistic enough that everything will work just fine, well Facebook worked well but Google Sign-in applied the known saying:

It never works the first time

At first I thought it is just a casual error and tried to understand it, I obviously checked Stackoverflow, GitHub issues and the official documentation but it wasted hours and hours of my time with no solution, and that’s what pushed me to write an article about how to fix it…

Debugging the error

Attempt 1 : Checking if I missed enabling Google Sign-in on Firebase

Although I was 100% sure that I did enable it but I checked anyway, all I had to do is heading over to my Firebase console, choosing my App and under Authentication » Sign-in method, checked if Google Sign-in was enabled or not.

Image for post

— Hypothesis dismissed 👎

Attempt 2: Checking if the project support email is configured

Well After some Googling I found out that the support email should be provided in order for the Sign-in to work, I knew I didn’t configure it so I applied the following process to add it :
In my App in the Firebase console, and under Authentication » Sign-in method, and having enabled Google Sign-in, I selected the Google Sign-in option. And finally added the support email.

Image for post

After adding the support email, I was optimistic enough that I fixed the issue, I rebuilt the App and tested it again but there were the surprise 12500 shows up again…

— Hypothesis dismissed 👎

Attempt 3: Checking if the SHA-1 (certificate fingerprint) is configured correctly

Along the Googling process for for the causes of my problem, the SHA-1 issue showed up several times but I was sure enough that it was well configured that I gave priority to other hypotheses, anyway after all the previous attempts didn’t resolve the issue (wasting hours of my time) I decided to check with the SHA-1 as a last hope…

I was desperate enough to regenerate the SHA-1 using several methods, (you can check this or the official documentation) in order to double or triple check the SHA-1. As common sense says the SHA-1 were the same in every and each attempt…
To add the SHA-1 to your App you can check this.

Image for post

PS: make sure to update the google-services.json file each time you change the SHA-1. Anyhow, no matter the times I changed the SHA-1 the 12500 kept showing…

— Hypothesis dismissed 👎

Attempt 4: Add an application logo to your project in the Google Cloud Platform console

After doing all the above, I lost hope of resolving the issue and even started thinking of starting a new project hoping to not face the issue again, but I decided to use the power of communities and ask for help, I posted about the issue in several slack workspaces and work on other things while waiting till someone replied suggesting to add a logo in my Firebase app’s configuration, Something I never thought would cause such an error, but I tried it anyway since I had no other choice, by doing the following :

In my Google Cloud Platform, and after selecting my project, on the left navigation bar, under Credentials » OAuth consent screen, I scrolled down to the application logo section, and added a random picture to just test it then clicked save, tried the App debugging version that existed in my phone already and it really worked.

Image for post

I still don’t know why, but the Firebase application’s logo seems to be a necessary thing for Google Sign-in…

— Hypothesis is the Eurêka !!! 👍

Final thoughts

As you can see, it was not easy at all to find the cause of the bug. This is one of the moments that pushes you to think out of the box and surely convince you how helpful the community can be.

These are some of the lessons I learned because of this experience :

  • Error messages are neither 100% correct nor clear. (Showing a 12500 error with no details is not helpful at all).
  • Reading carefully the Android documentation is not easy but it’s very important so you can understand how it works but sometimes they can be not helpful at all.
  • As a Developer, being an expert Googler is something crucial…
  • Developers Communities are great thanks to all the people sharing their experiences and trying to help whoever in need.
  • It is not always something logical that causes the error, think out of the box and expect everything.
  • Errors do waste time but they give you lessons and experiences that you can’t deny their importance.

That’s it, I hope you like it and find it useful at some point. I would really appreciate your feedback and if you needed any help just give me a DM.