Google Login error 10

Hello,

I have been struggling for two days on this problem and I’ve decided to reach out for help.

I am trying to implement Google Login with firebase and Ionic 3, but I keep getting error “10” on login.

Firebase setup:
I created and iOS and Android app in Firebase. Then followed this turorial: https://javebratt.com/ionic-google-login/

REVERSED_CLIENT_ID:
I searched for where I should get the REVERSED_CLIENT_ID. Strange as it can be, the tutorial is saying it should be the same as the webClientId, but then the official doc for the plugin says something else (https://github.com/EddyVerbruggen/cordova-plugin-googleplus), and finally the official Ionic website says in a tutorial something different (https://docs.ionic.io/services/auth/google-native.html) from the other two. So, I got my REVERSED_CLIENT_ID from the config file downloaded from my iOS Firebase app dashboard.

webClientId:
So, now the webClientId: I got it from the “Web client (auto created by Google Service)” in the “OAuth 2.0 client IDs” section of my Google Developer console credentials that were created automatically by Firebase for my project.

SHA-1 signture:
Now the SAH-1 signature from debug.keystore. I didn’t have a debug.keystore in my ~/.android/ folder, so I created one using Android Studio. I got the SHA-1 using key tool and registered it to my Firebase Android app dashboard.

When I deploy to android using

ionic cordova run android -l -c

and click the Google Login button, I get the login prompt. But when I click on the Google account I want to use for sign-in, the prompt closes and the promise is rejected and goes throw the catch. The error contained in the callback is just 10. No message, nothing, juste 10:

I have searched the web for this issue, but couldn’t find any help or sometimes contradicting solutions:






The only difference with all the tutorials I found is that my created my Google Credentials were automatically setup by Firebase.

Thanks a lot for your help !

1 Like

You are not implementing Ionic Auth, the Ionic Service, right?
If so, this page is irrelevant to you with Ionic Native Google Plus.

No, I am not implementing Ionic Auth. I am implementing Firebase auth, but using the native Google Plus Cordova plugin. I am using AngularFIre2 to implement auth, but when the platform is “cordova”, the docs shows how to implement the solution using the native plugin (at least for Facebook, but it’s similar for Google, just the plugin setup is different): https://github.com/angular/angularfire2/blob/master/docs/Auth-with-Ionic3-Angular4.md

1 Like

I also followed this tutorial - https://javebratt.com/ionic-google-login/ and got Error 10 when I run it on Android devices.

Hello,

I finally found a solution. I knew there was something to do with cordova not signing the APK with my ~/.android/debug.keystore file, so I created a debug-signing.properties file in the platforms/android folder and specified there the keystone path, password etc.

Things worked fine after that :slight_smile:

Cheers !

5 Likes

I just found another working solution too:

  1. generate your private key
    $ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

  2. get SHA1 from the key that you generated above
    $ keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

  3. use that SHA1 here to get all your necesarry token, IDs or keys --> https://developers.google.com/mobile/add?platform=android&cntapi=signin

  4. release build your app to generate an unsigned apk file
    $ cordova build android --release

  5. jar sign that apk file with the above keystore
    $ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name

Reference:
http://ionicframework.com/docs/v1/guide/publishing.html

1 Like

I needed a solution without signing anything. I ended up changing my package name to “io.ionic.starter” here: https://developers.google.com/mobile/add?platform=android&cntapi=signin

I think this might be an ionic bug if this solution works for others as well.

This is the default package name/id for created Ionic projects. Seems your project still has this (see conig.xml and /platforms)

Thank you! You save my time! No more Error 10, below is the sample of debug-signing.properties file

keyAlias=yourkeyAlias
keyPassword=yourkeyPassword
storeFile=theFileContainingTheKeystore
storePassword=yourStorePassword
4 Likes

Hello,
If you are using ionic cordova firebase: you should also entry your SHA1 in both console.developers.google.com and also in console.firebase.google.com settings
Hope its help.

I had this bug for days, my app was working fine when deployed to the device from the PC, in debug and release mode, login started falling when I published my app to the Android store, and install it from there, the problem was that the app signing was selected by default when you publish…


In order to fix this you have to get your SHA-1 fingerprint from the android developer console and add it to the firebase console…

I’ve created a blog post explaining it in details here
http://www.jomendez.com/2017/08/30/ionic-2-google-sign-in-error-10-with-firebase/

Hope it helps you :wink:

6 Likes

Thanks, the solution you provided helped me a lot. You saved my time…

Thanks to @gempain and @markitenz

This trick works for me. Thanks in advance!

I try everything that I found about this issue, but my app still does not work, keep returning me the error 10, HELP

I have the same problem in the last weeks, before it’s working fine. I can’t find a solution

Thank you brother, below is the sample of debug-signing.properties file in platforms/android

keyAlias=alias_name
keyPassword=my_key_password
storeFile=..\\..\\my-key.keystore
storePassword=my_store_password


2 Likes

Hello I have also stuck for many days in this error when i have first use this error occurs where your web client is not proper please get it from GCP and install it with the plugin and for IOS you also need reversed Client Id.
It Will work for sure.

keyAlias=’ ’
keyPassword=’ ’
storeFile=’ ’
storePassword=’ ’

what i will have to write there i am unable to understand

I’ve been experiencing this problem for days, even adding debug-signing.properties did not solve the issue. Running ionic cordova clean solved for me.

3 Likes

Cordova clean fixed it for me to. After HEAD BANGING for days… Thank you so much for posting!!!