我想在我的应用程序中集成g登录 . 我按照以下步骤操作:
首先,使用以下命令安装ionic-navtive gplus插件: ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid
使用从 console.developers.google.com
生成的反向客户端ID . 其格式为 xxxxxxxx-xxxxxxxxx.apps.googleusercontent.com
.
然后单击登录按钮尝试g本机呼叫 . 这是我的ts代码:
googleLogin() {
this.googlePlus.login({
'webClintId':'xxxxxxxx-xxxxxxxxx.apps.googleusercontent.com ',
}).then((res) => {
alert("Login successfull: " + res);
this.navCtrl.setRoot(HomePage);
}).catch((err) => {
alert("Login unsuccessfull: " + err);
});
}
在尝试上面的代码时,它将进入错误块和打印:
登录失败:17
我跟着:https://ionicthemes.com/tutorials/about/ionic2-google-login
1 回答
您不需要将webClientId放在
GooglePlus.login()
中 .您的登录方法应该是(如果没有其他选项) -
iOS
你需要在
config.xml
中放置REVERSED_CLIENT_ID
for iOS .要找到您
REVERSED_CLIENT_ID
,请在开发人员控制台中转到凭据,然后单击已创建的iOS凭据和Download Plist
.Android
对于Android你不需要任何id,它适用于
Signing-certificate fingerprint
,确保你在创建oauth client id
时Signing-certificate fingerprint
和Package name
是正确的 .如果您没有使用任何创建的密钥库文件对apk进行签名,请使用
SHA-1 signing-certificate fingerprint
的默认debug.keystore文件 .我使用了最常见的
debug.keystore
(windows)路径 . 对你来说可能有所不同,只需寻找.android
dir .