17

I've made a chat app that uses Firebase's feature Real-time database. I face a problem with google authentication. The problem started when I downloaded the app from the Play Store, the authentication was working perfectly when I was running the app in debug mode. When users try to sign in they get a toast message code:10 message:10.

I would like to note here that: I've added the SHA1 fingerprint. How can I solve this?

*Not sure if this is helpful but I've followed step by step this tutorial

Alex Mamo
  • 112,184
  • 14
  • 139
  • 167
Kwnstantinos Nikoloutsos
  • 1,382
  • 4
  • 13
  • 28

3 Answers3

26

You need three keys in order to make it work:

  1. The debug key. Informations here.

  2. The release key. Informations here.

  3. Google Play App signing key. Informations here.

All these keys are needed in order to make the sign-in process work.

Other informations here.

Alex Mamo
  • 112,184
  • 14
  • 139
  • 167
  • 2
    I found this answer in another post in stackOverflow but as I am a beginner I don't know how to get all these keys! Can you edit your answer and elaborate it a little bit :) ? – Kwnstantinos Nikoloutsos Jul 16 '18 at 11:11
  • I've added a debug and release SHA1 fingerprint but I don't understand how to add the third key ( google play app signing key) . – Kwnstantinos Nikoloutsos Jul 16 '18 at 11:43
  • That is the official documentation but please take also a look [here](https://stackoverflow.com/questions/44103024/how-to-enable-google-play-app-signing). – Alex Mamo Jul 16 '18 at 11:47
  • 1
    Thank you a lot, actually it wasn't that hard to find that google play app key. Now the google authentication works perfectly fine :) – Kwnstantinos Nikoloutsos Jul 16 '18 at 11:55
  • @AlexMamo where to put the app signing key and what should be my default_web_client_id (within requestIdToken params), Pls check my issue on https://stackoverflow.com/questions/54861698/firebase-google-signin-error-com-google-android-gms-common-api-apiexception-10. its really urgent – Shikhar Feb 26 '19 at 10:45
  • @ShikharJaiswal You should add the debug and release key in your Firebase console. – Alex Mamo Feb 26 '19 at 10:46
  • @AlexMamo I've added debug key into my firebase app, (by generating the signing report)...Pls tell more about release key and where to add it, i followed the above link and when I run the command ($ keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v ) i get the same key as SHA1 generared throug signing report previously – Shikhar Feb 26 '19 at 11:08
  • @ShikharJaiswal See here on SO more [similar questions](https://stackoverflow.com/search?q=firebase+release+key). – Alex Mamo Feb 26 '19 at 11:13
  • @AlexMamo Please help me out. I've already researched a ton of questions for the past 2 days, but Im completely stuck here and my release date is near. Pls help – Shikhar Feb 26 '19 at 11:27
  • Should we remove the debug key from Firebase after we hit production since everyone could have the same key? – Jack Apr 09 '19 at 07:51
  • @jackz314 It's up to you to decide that. – Alex Mamo Apr 09 '19 at 08:24
  • I've done all this and still getting the same error. What could I also check? – Stephan Jun 22 '20 at 08:33
  • 1
    A fourth key will be needed if you intend on using internal app sharing: https://stackoverflow.com/a/62763633/1702810 – Stephan Jul 06 '20 at 20:04
15

After generating SHA1 for release key, I forgot downloading the new google-service.json file that caused the same error.

Make sure you follow the instruction https://developers.google.com/android/guides/client-auth to generate and add debug/release SHA1 to firebase console and download google-service.json after updated.

If you use Use app signing by Google Play option, you need an additional step:

After uploading app into google play console, go to Release management > App signing, copy SHA1 and paste to firebase console enter image description here

Update

In the new google play console, the App signing key can be found as following: Setup > App signing enter image description here

Hasan El-Hefnawy
  • 871
  • 1
  • 11
  • 19
thanhbinh84
  • 16,490
  • 4
  • 52
  • 67
2

Make sure you have added signed SHA1. If you are using debug one then it will not gonna work for live apk.

You need to put "debug.keystore" in this path C:\Users\USER_FOLDER_NAME.android

then in Android studio follow the below steps 1. Run your project 2. Click on Gradle menu 3. Expand Gradle Tasks tree 4. Double click on android -> signingReport

You can see SHA in Run Tab

for more information see link

  • Okay, how can I obtain a signed SHA1? – Kwnstantinos Nikoloutsos Jul 16 '18 at 11:12
  • You need to put "debug.keystore" in this path `C:\Users\USER_FOLDER_NAME\.android` then in Android studio follow the below steps 1. Run your project 2. Click on Gradle menu 3. Expand Gradle Tasks tree 4. Double click on android -> signingReport You can see SHA in Run Tab – Riddhi Shankar Jul 16 '18 at 11:27
  • @KwnstantinosNikoloutsos please check the answer, I have updated it. – Riddhi Shankar Jul 16 '18 at 11:44
  • I have added this SHA1 fingerprint in firebase console and I am waiting to see if it is working :) Thank you for the help, I will keep you updated – Kwnstantinos Nikoloutsos Jul 16 '18 at 11:48
  • I fixed it. Apart from adding the SHA1 key that you have told me about, we also need to add the Google Play App signing key as Alex Mamo said. – Kwnstantinos Nikoloutsos Jul 16 '18 at 11:57
  • @Kwnstantinos Nikoloutsos where did you put the app signing key? – Shikhar Feb 26 '19 at 10:42
  • It is important that Gradle can give you not only release hash, but also the debug hash! I spent one day to find debug key, but it actually was near the release key (downside the console output) – Egor Apr 10 '20 at 04:20