Cordova plugin googleplus error 10
StefaniToto opened this issue ยท 21 comments
Hello.
Im having error 10 with plugin googleplus.
Steps that have followed.
-
ionic cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid
npm install --save @ionic-native/google-plus -
at config.xml
name of package same as oath2 at google cloud
-
build.json file
{
"android": {
"debug": {
"keystore": "my-release-key.keystore",
"storePassword": "...",
"alias": "alias_name",
"password" : "...",
"keystoreType": ""
},
"release": {
"keystore": "my-release-key.keystore",
"storePassword": "",
"alias": "alias_name",
"password" : "...",
"keystoreType": ""
}
}
} -
create debug.signing.properties
key.store=/home/s/Desktop/new-folder/my-release-key.keystore
key.alias=alias_name
key.store.password=...
key.alias.password=...
5.gradle.properties
cdvDebugSigningPropertiesFile=debug-signing.properties
cdvReleaseSigningPropertiesFile=debug-signing.properties
Everything builded pretty fine. But its giving error 10.
Id is fine, package name too.
Have checked several time
Also
./gradlew signingReport
verify the SHA1
Error 10 happens mainly for 2 reasons
- Invalid SHA-1 Key make sure, you've updated SHA-1 key on the correct project
- Support email make sure, you've added support email on your Firebase project
I have the same problem with my Ionic App, must have tried all the recommendations in GitHub, and StackOverflow, and a few got it working with these recommendations, interesting is that the same steps I followed but not working though
@nagthgr8 the trick its on signing process.
You have to add the sha key on https://console.cloud.google.com.
And if you are on testing phase the key its always on the ~/.ssh/id_rsa.pub. (Check your default one)
I have made a working demo but its all about signing the app.
https://github.com/StefaniToto/Ionic5-Gmail-Login
Thanks @StefaniToto I will give it a try, the only difference I could see from your code is that I am using awesome-cordova-plugins/google-plus/ngx instead ionic-native/google-plus/ngx when I use ionic-native I get compatibility issues, I know this could be resolved with --force or --resolve-legacy-peers, I think there is a sha-key issue with mine as I see the warning The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format,
@nagthgr8 no worry, that was before 1-2 year code. Im using right now awesome-cordova-plugins/google-plus/ngx and its working. The old plugion doesnt exist anymore.
Just try to use the same key format and register also there on cloud console otherwise will not work.
If you create the debug file and sign it with same key will work.
But as a developer i wanna run with --liverload and that take as sign the default key of pc.
Thanks @StefaniToto I am just testing the prod version, I now migrated the key format as recommended, however the SHA-1 is same as before, I also added the SHA-1 key to the firebase project as suggested, I doubt there must be also some issue with the JDK as I have both JDK 8(1.8) and the OpenJDK 25(Java HotSpot TM) installed on my PC, both are recognized when I give java -version, not sure if this could be some issue
I now getting compiler issue after migrating the key with keytool -importkeystore
parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)
I figured out there is JDK issue, after reinstalling to JDK 8u331, able to compile successfully, but still not able to sign in with google , after following all the steps, I could not figure out where things are going wrong, the last option is regenerating the SHA-1 key, but that will end up creating the new App in the google Play store, I could give this a try but would like to fix with exising SHA-1 key
You can change in case of lost/update the key on play store.
Finally, I am able to fix the login issue, the issue is with the sign-in key, which is different than the key shown in the google developer console under App Integrity->SignIn, I noticed there are 2 different keys 1 is for authenticating with API vendors and the other one is the Upload key which is same as the key used to sign-in during the build process. On many sites, they recommend using the SHA-1 fingerprint of the key used during the build process, but this is not the case. Instead, we should be using the SHA-1 fingerprint of the key available in AppIntegrity->SignIn provided for API vendor access
Now, the second issue I am experiencing is with getting birthday & gender, I tried Google people API but that has limitations it only works if the birthday & gender are public, I think there is way to get birthday from googleplus api OAuth2 (even if private), but I think it cannot fetch gender
Yeah. Im happy you fixed. I spend lots of time also figuring out that all is matter of SSH key.
Regarding private fields not sure if its possible. But in my app i took email and name, surname so they can be "trustfull" users.
Than i made on the app restrictions for them that dont have profile pic, gender, location and few other filters im using.
Thanks, @StefaniToto I too follow the same, instead of relying on People API just use fields returned by the .login function & then allow users to enter other information as needed.
Hello @StefaniToto @nagthgr8
I'm also facing this issue.
What code error ?
I tried yesterday on a new project and its working.
-
Generate a new key and put your passowrd
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000 -
Copy and replace your key to this location. (change with your directory pc). Make a backup of your old key if you want.
C:\Users\stefani\.android -
Get ssha1
keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android -
Go to your cloud console develop (https://console.cloud.google.com) and create an Oauth key for Android and put there the SSHA!.
-
In OAuth constent screen insert your test gmails accounts and than login in with that email.
Will work like a charm.
@StefaniToto ,
Here is my ionic info:
$ ionic info
Ionic:
Ionic CLI : 6.18.1 (C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 5.9.3
@angular-devkit/build-angular : 0.1002.4
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0 (cordova-lib@10.1.0)
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res (update available: 0.15.4) : 0.15.3
native-run (update available: 1.6.0) : 1.4.0
System:
Android SDK Tools : 26.1.1 (C:\Users\USER_NAME\AppData\Local\Android\Sdk)
NodeJS : v14.17.5 (C:\Program Files\nodejs\node.exe)
npm : 6.14.14
OS : Windows 10
In my case, I am able to build & sign in with google for the IOS platform on real devices. But it is not working for android devices.
Previously, It was working as it is but I don't know why the sign-in gets stuck in android.
Any suggestions for my case, please?
@StefaniToto
And I'm getting this error:
and also here is the code:
this.google.login(login).then(async (res) => { // Some of my Login Logic }).catch((err) => { console.log("err(1):", err); this.commonService.showToast("Unable To Login Via Google"); });
Is anything wrong?
@StefaniToto And I'm getting this error:
and also here is the code:
this.google.login(login).then(async (res) => { // Some of my Login Logic }).catch((err) => { console.log("err(1):", err); this.commonService.showToast("Unable To Login Via Google"); });
Is anything wrong?
You are missing one of the steps i mentiooned up. And its usually a SSHA issue.
// Some of my Login Logi, make a console.log here also
Hello @purelydeft @StefaniToto ,
I have fixed this issues through this way:
In Android Studio terminal:
Step 1: Go to this location:
C:\Program Files\Java\jre1.8.0_321\bin>
Step 2: Run below command:
keytool -list -v -keystore "c:\users\USER_NAME\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Step 3: Copy the SHA1:
Certificate fingerprint: SHA1:
:**::**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
Step 4: Go to firebase console:
https://console.firebase.google.com/project:
โ Project settings โ Your Apps โ Android apps
Chose your android App:
Add new SHA certificate fingerprints:
Copy SHA1 key from step 3
:**::**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
Paste SHA1 & save.
Kill the app and relaunch and the issue is fixed.
Let me know if it is helpful to anyone.
Thank you
Thank you so much @suraj-singhsu
It's working for me.
Hello @purelydeft @StefaniToto ,
I have fixed this issues through this way:
In Android Studio terminal: Step 1: Go to this location: C:\Program Files\Java\jre1.8.0_321\bin>
Step 2: Run below command:
keytool -list -v -keystore "c:\users\USER_NAME\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Step 3: Copy the SHA1: Certificate fingerprint: SHA1:
:**::**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
Step 4: Go to firebase console: https://console.firebase.google.com/project: โ Project settings โ Your Apps โ Android apps
Chose your android App:
Add new SHA certificate fingerprints:
Copy SHA1 key from step 3
:**::**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
Paste SHA1 & save.
Kill the app and relaunch and the issue is fixed.
Let me know if it is helpful to anyone.
Thank you
This is in case you use firebase. In case you dont use firebase its google cloud developer.
https://console.cloud.google.com/
On Local testing need get and update the SH1 key
Simply run this command to get SH1 key
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
And update this in the google app firebase console or google app console.