Google 加上带有 webClientId 的原生插件

Google plus Native plugin with webClientId

我在 Ionic 3 应用程序中使用 native Google Plus 插件。

Login()方法是这样的:

login(){

        GooglePlus.login({
          'webClientId': '*************************'
        }).then((res) => {
            console.log(res);
        }, (err) => {
            console.log(err);
        });

    }

这里的问题是关于 webClientId。因此我在开发者控制台上创建了 2 个应用程序(iOS 和 Android),它显示了 2 个不同的 webClientIds.So 我应该为上面的代码赋予哪个值?

有帮助link: Ionic Google Authentication

插件 link: enter link description here

您不需要将 webClientId 放入 GooglePlus.login()

您的登录方式应该是(如果没有其他选项)-

GooglePlus.login({}).then((res) => {
    console.log(res);
}, (err) => {
    console.log(err);
});

iOS

您需要将 REVERSED_CLIENT_ID 放入 config.xml 中以获得 iOS。

<plugin name="cordova-plugin-googleplus" spec="~5.1.1">
        <variable name="REVERSED_CLIENT_ID" value="com.googleusercontent.apps.967272422526-vu37jlptokv45glo2kciu9o2rddm7gte" />
</plugin>

要找到您 REVERSED_CLIENT_ID,请在开发人员控制台中转到凭据并单击创建的 iOS 凭据和 Download Plist

Android

对于android你不需要任何id,它适用于Signing-certificate fingerprint,创建[=21=时确保Signing-certificate fingerprintPackage name是正确的].

如果您没有使用任何已创建的密钥库文件对 apk 进行签名,则使用默认 debug.keystore 文件的 SHA-1 signing-certificate fingerprint

keytool -exportcert -keystore C:\Users\Username\.android\debug.keystore -list -v

我用过最常用的路径debug.keystore (windows)。它可能对您有所不同,只需查找 .android dir.