Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep getting error 10 on both device and emulator #260

Closed
peterwilli opened this issue Aug 9, 2016 · 14 comments
Closed

Keep getting error 10 on both device and emulator #260

peterwilli opened this issue Aug 9, 2016 · 14 comments

Comments

@peterwilli
Copy link

@peterwilli peterwilli commented Aug 9, 2016

Hi guys,

I am currently stuck in this issue for 3 days :( I'm trying to implement Google Native Login trough this plugin and it never worked. I checked everything (debug certificate sha1 signature, package name, etc) and I keep getting error 10. I tried logging out and in again, on emulator and device the same results.

I also checked #243 which the same issue is discussed, but no luck either.

I also made a clean project with the original example which also doesn't work for me. I am really desperate, and am hoping other people would know what to do, thanks!

My specs are:

  • Git version of this plugin
  • Cordova 6.2.0
  • Ubuntu 16.04 LTS 64-bit
  • Android Emulator device: Google APIs x86 Atom_64 (Android 5.0.1, API 21)

More info can be supplied on request, thanks!

@sammugg

This comment has been minimized.

Copy link
Collaborator

@sammugg sammugg commented Aug 9, 2016

Hey @peterwilli, make sure your are passing in a ClientId of type Web Application (not of type Android or other).

Also, make sure that you have the following items installed and up-to-date in your SDK manager:

  1. SDK Tools (latest)
  2. Platform-tools (latest)
  3. Build-tools (latest)
  4. API 23 or less (Cordova 6.x and Cordova-android 5.x only support up to 23) with the following:
    1. SDK Platform (keep up to date)
    2. An emulator image that includes Google APIs (i.e. Google APIs Intel x86 Atom System Image)
    3. Google APIs (the standalone install)
  5. Android Support Repo (latest)
  6. Google Play Services (latest)
  7. Google Repository (latest)

I just built and ran a POC app using v4.0.9 of this plugin (which has play-services-auth:+ and play-services-identity:+ in the plugin.xml). Everything worked properly.

Other POC info:
API version 23
Latest versions of all "latest" items listed above
Running on Emulator: Google APIs Intel x86 Atom_64 System Image
Cordova: v6.3.0
Cordova-android: v5.2.1
Java JDK: 1.8.0_102

@peterwilli

This comment has been minimized.

Copy link
Author

@peterwilli peterwilli commented Aug 10, 2016

Hi @sammuggPS,

I shoudln't have to use a ClientId right? This is the example I've been trying: https://github.com/EddyVerbruggen/cordova-plugin-googleplus/blob/master/demo/index.html

As for the build-tools and SDK tools, everything is up-to-date except for my Google APIs but I'm on holiday right now with a bad connection so I can't update this week :( But the Google API's was up-to-date a week ago so it's still pretty recent.

Is this plugin still working for you? If so, do you have a working app on the playstore so I can see it works on my device(s) as well? Thanks!

@sammugg

This comment has been minimized.

Copy link
Collaborator

@sammugg sammugg commented Aug 10, 2016

No, you shouldn't have to use a ClientId. You should be able to call the plugin with an empty object. Just keep in mind that in order to get an idToken back, you have to pass in the ClientId.

Your Google APIs should be fine if they were up to date a week ago.

I don't have an app on the app store, sorry. Just a local POC I did for work (so I can't share it, sorry). It is working for me, though, with the specs I mentioned above.

It sounds like the same issue, found in #243, was fixed by making sure the correct SHA1 is hooked up on your developers console.

@peterwilli

This comment has been minimized.

Copy link
Author

@peterwilli peterwilli commented Aug 10, 2016

@sammuggPS Alright thanks for the heads-up. The fact that you've got it working locally is enough for me to be confident :) It's currently all I'm trying to do too (I do want it to be working in a production app ofcourse, but for now I want the simplest part to work before I move back to the production side)

I have checked everything regarding my SHA1 (even pulled the SHA1 hash from the APK in case there was a different certificate used than the debug certificate)

What does bother me is that I get also error 10 is I change the package name in the app. That should indicate that something other than the SHA1 hash on the developer console might be wrong.

@sammugg

This comment has been minimized.

Copy link
Collaborator

@sammugg sammugg commented Aug 10, 2016

Well, Google identifies an app with to its dev console using the SHA1 and the package name. If the SHA1 is already incorrect (i.e., doesn't match any projects), then changing the package name wouldn't cause a different error to show up.

Also, try removing then re-adding your platform. Sometimes that resolves some weird issues, especially when using cordova plugins.

@peterwilli

This comment has been minimized.

Copy link
Author

@peterwilli peterwilli commented Aug 11, 2016

@sammuggPS thanks, I'll also try to remove and remake a new project on the Google API Console while I'm at it.

I have to wait a bit for that though as I have reached my max projects limit, so I had to remove a few which don't get removed instantly. I'll get back here with results when I'm done!

@sammugg

This comment has been minimized.

Copy link
Collaborator

@sammugg sammugg commented Aug 11, 2016

Awesome, thanks for the update. Godspeed!

@almoore

This comment has been minimized.

Copy link

@almoore almoore commented Aug 11, 2016

I am having this same issue. I am having trouble with the latest build and using the ionic package build android command.

@sammugg

This comment has been minimized.

Copy link
Collaborator

@sammugg sammugg commented Aug 11, 2016

@almoore, Make sure that the client id you're passing in to the plugin (for webClientId) is of type Web Application, not of type Android, iOS, or other.

Make sure that you're Android SDK is completely up to date (see the list posted in my initial response above).

Finally, make sure that the SHA1 you used to set up in the developer's console is the same one that ionic is using when it builds your app. If it's not, log in will not work.

@peterwilli

This comment has been minimized.

Copy link
Author

@peterwilli peterwilli commented Aug 15, 2016

@sammuggPS WTF.. it suddenly works! Thanks!
What I did was completely remove the project from google developer console and started out fresh.

@peterwilli peterwilli closed this Aug 15, 2016
@signalpoint

This comment has been minimized.

Copy link

@signalpoint signalpoint commented Nov 10, 2017

On Android

Sweet beans and tangerines, error 10 haunted my dreams last night. Thank you to many of the commentators here, I apparently digested your findings while sleeping and the first thing I tried this morning fixed it, after wasting many hours yesterday.

The Fix

In my cordova project's platforms/android directory, the debug-signing.properties file did not have the correct values, the values that worked for me are listed below:

storeFile=/home/MY_USER_NAME/.android/debug.keystore
storePassword=android
storeType=jks
keyAlias=androiddebugkey
keyPassword=android

That was it for me, the plugin started working immediately after using cordova prepare and then compiling and running it with cordova run android!

The Back Story

Since I had wrongfully placed production key values into my debug-signing.properties long ago, and now that I have come back to work more with this Plugin, I went ahead and created a development API Key and two OAuth 2.0 Client Ids in the Google Console, and thought I hooked everything up correctly and followed many tactics described by others experiencing the same issues, but my development efforts stalled for many hours due to error 10. The fix above, was all I needed.

Along the way though, I learned some new things (hopefully), and wanted to share a summary of things to document for others and future self:

  • the webClientId value needed by this plugin comes from Google Console, it is in the OAuth 2.0 client IDs section, will be of type Web application and in the ClientID column, it will look something like this: 123456789-abc987654321.apps.googleusercontent.com - this OAuth 2.0 client ID also contains a Client secret value, which can be used in conjunction with the serverAuthCode (returned by this plugin's API, e.g. login result) to get an access_token back from Google.
  • in the Google Console, you also need to create an OAuth 2.0 client ID of type Android and sign it with the SHA-1 fingerprint using either the debug.keystore file mentioned above, or your very own .keystore file that you use for the production release.
  • In my config.xml file, this is the only value needed for this plugin on Android, e.g. <plugin name="cordova-plugin-googleplus" spec="~5.1.1" />, I did not need to specify the REVERSED_CLIENT_ID during cordova plugin add

TLDR

While developing and using a debug keystore, my platforms/android/debug-signing.properties had incorrect values.

@A110SHT

This comment has been minimized.

Copy link

@A110SHT A110SHT commented Apr 25, 2018

i am having the same issue.
capture
capture1

what did wrong. please correct me.
capture2
i am buliding this project on visual studio 2017 android sdk 26 cordova v 6.3.1
i try to slove this problem by above example but no luck.

@jirawutch

This comment has been minimized.

Copy link

@jirawutch jirawutch commented Feb 23, 2019

019-02-23 11:06:29.140 15895-15895/com.mynew.driverapp W/InputMethodManager: startInputReason = 1
2019-02-23 11:06:29.265 15895-15895/com.mynew.driverapp W/SignInActivity: signInResult:failed code=10
2019-02-23 11:06:29.267 15895-15895/com.mynew.driverapp W/InputMethodManager: startInputReason = 1
2019-02-23 11:06:29.290 15895-15935/com.mynew.driverapp W/libEGL: EGLNativeWindowType 0x7dca27d010 disconnect failed
2019-02-23 11:06:29.321 15895-15895/com.mynew.driverapp D/ActivityThread: Remove activity client record, r= ActivityRecord{dc74395 token=android.os.BinderProxy@cf0af1c {com.mynew.driverapp/com.google.android.gms.auth.api.signin.internal.SignInHubActivity}} token= android.os.BinderProxy@cf0af1c

I have fixed by google OAuthen 2.0 key. something might not setup correctly. check your key and configuration.

image

@DuaneQ

This comment has been minimized.

Copy link

@DuaneQ DuaneQ commented Feb 13, 2020

On Android

Sweet beans and tangerines, error 10 haunted my dreams last night. Thank you to many of the commentators here, I apparently digested your findings while sleeping and the first thing I tried this morning fixed it, after wasting many hours yesterday.

The Fix

In my cordova project's platforms/android directory, the debug-signing.properties file did not have the correct values, the values that worked for me are listed below:

storeFile=/home/MY_USER_NAME/.android/debug.keystore
storePassword=android
storeType=jks
keyAlias=androiddebugkey
keyPassword=android

That was it for me, the plugin started working immediately after using cordova prepare and then compiling and running it with cordova run android!

The Back Story

Since I had wrongfully placed production key values into my debug-signing.properties long ago, and now that I have come back to work more with this Plugin, I went ahead and created a development API Key and two OAuth 2.0 Client Ids in the Google Console, and thought I hooked everything up correctly and followed many tactics described by others experiencing the same issues, but my development efforts stalled for many hours due to error 10. The fix above, was all I needed.

Along the way though, I learned some new things (hopefully), and wanted to share a summary of things to document for others and future self:

  • the webClientId value needed by this plugin comes from Google Console, it is in the OAuth 2.0 client IDs section, will be of type Web application and in the ClientID column, it will look something like this: 123456789-abc987654321.apps.googleusercontent.com - this OAuth 2.0 client ID also contains a Client secret value, which can be used in conjunction with the serverAuthCode (returned by this plugin's API, e.g. login result) to get an access_token back from Google.
  • in the Google Console, you also need to create an OAuth 2.0 client ID of type Android and sign it with the SHA-1 fingerprint using either the debug.keystore file mentioned above, or your very own .keystore file that you use for the production release.
  • In my config.xml file, this is the only value needed for this plugin on Android, e.g. <plugin name="cordova-plugin-googleplus" spec="~5.1.1" />, I did not need to specify the REVERSED_CLIENT_ID during cordova plugin add

TLDR

While developing and using a debug keystore, my platforms/android/debug-signing.properties had incorrect values.

@signalpoint I've been stuck on this for a while. I have the same issue. How do i check if the sha1 is correct? I deleted my Android app in firebase and deleted the credential in the console and started over but now I'm not sure what to do.

Here is my stackoverflow post.

https://stackoverflow.com/questions/60179370/cannot-read-property-idtoken-of-undefined-ionic-google-android-authentication?noredirect=1#comment106441865_60179370

Any help would be greatly appreciated.

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'idToken' of undefined TypeError: Cannot read property 'idToken' of undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.