Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor.loginWithGoogle error 10 on android

I used the function Meteor.loginWithGoogle as below to login with google. It's working on browser but It's fail (the console log is error 10) when I build to apk (by cordova).

handleLoginError(err, service) {
   console.error(err);
}

Meteor.loginWithGoogle({}, (err) => {
  if (err) {
    this.handleLoginError(err, 'google');
  } else {
    this.handleLoginSuccess();
  }
});
like image 228
Quy Ba Pham Avatar asked Aug 24 '17 07:08

Quy Ba Pham


People also ask

What does error 10 mean in Google API?

Looking at the official common status code from google API, the Error 10 = DEVELOPER_ERROR. Then you might be want to check your android manifest but the manifest is fine. So you have to check the clientId on your google console.

Why am I getting a code 10 error on my Device?

A problem with the hardware device itself might be causing the Code 10 error, in which case replacing the hardware is your next logical step. Another possibility, while not very likely, is that the device is not compatible with your version of Windows.

What does error response code 10 mean?

I have also been getting the same error response for the past few days; I have been trying to fixed the problem but no breakthrough and I learnt that the response code (10) means it is a developer problem. I hope someone can profer a solution here.


1 Answers

Just found the solution on https://forum.ionicframework.com/t/google-login-error-10/93230/4

In your case, Cordova is not signing your APK correctly. This is why the error only occurs in the apk. You can solve this by creating a valid keystore, which Cordova can use to sign the apk.


Option 1

You can create the keystore using e.g. this command: keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 Make sure to edit it to your needs. If you want to know more about this command, you can read this answer.

Next, you neew to get the SHA1 from the key you just generated using this command: keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

You can use this SHA1 to get your token, IDs and keys from https://developers.google.com/mobile/add?platform=android&cntapi=signin

Use the command meteor build android --release to build your app and to generate an apk file.

Finally you can use the command jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name to jar sign the generated apk file with the keystore.


Option 2

Alternatively you can create a signing properties file platforms/android/debug-signing.properties containing your keystore file, password as shown below. Example:

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

You can get more information about this in the publishing documentation: https://ionicframework.com/docs/v1/guide/publishing.html

like image 87
Marvin Klar Avatar answered Sep 30 '22 21:09

Marvin Klar