Cordova Android App Google Plus Authentication Error 10

狂风中的少年 提交于 2019-12-10 12:19:16

问题


I want to use google plus authentication in my cordova app.

1. Generate keystore

keytool -genkey -v -keystore <keystoreName>.keystore -alias <Keystore AliasName> -keyalg <Key algorithm> -keysize <Key size> -validity <Key Validity in Days>

2. Create android release version

cordova build android --release

3. Sign My Apk

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <keystoreName>.keystore android-release-unsigned.apk <alias>

4. Optimize my APK

zipalign -v 4 android-release-unsigned.apk <output name>.apk

5. ADD android app in: http://console.firebase.google.com.

6. Get hash from my keystore

keytool -exportcert -keystore <keystoreName>.keystore -list -v -alias <alias>

7. Add SHA1 hash for my adroid app

8. After that i can see client id for android in: https://console.developers.google.com/apis/credentials?project=

9. I'm install this plugin: https://github.com/EddyVerbruggen/cordova-plugin-googleplus.

10. My code in app:

window.plugins.googleplus.getSigningCertificateFingerprint(
    function (fingerprint) {
        alert(fingerprint); // SHA1 HASH - It's same like in console.firebase.google.com
    }
);

window.plugins.googleplus.login(
    {
        'scopes': '',
        'webClientId': '62......39.6-..................jjka5b...v87q7.apps.googleusercontent.com', // optional clientId of your Web application from Credentials settings of your project - On Android, this MUST be included to get an idToken. On iOS, it is not required.
        'offline': true,
    },
    function (obj) {
        alert(JSON.stringify(obj));
    },
    function (msg) {
        alert('error: ' + msg); // error 10
    }
);

I'm install apk on my android device and always get error 10.

I installed and successfully use facebook plugin for cordova. It's work good! But i can't solve problem with google. What am I doing wrong?

Can anybody help me...

I regenerated keystore... Reinstall cordova... Reinstall googlepus plugin...


回答1:


My problem solved!!!

I use clientID "Web client (auto created by Google Service)" instead of clientID "Android client for com.android.app (auto created by Google Service)". It's work! I get token and user data!



来源:https://stackoverflow.com/questions/46893815/cordova-android-app-google-plus-authentication-error-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!