我正在开发一个本机应用程序,我想让我的用户能够使用Google登录。但是,当我向Google API发出请求时,它会返回WRONG SIGNIN Error: DEVELOPER_ERROR
。
我正在使用AWS Cognito,并希望将Google登录名与其集成。我看到了一些问题,据说这些问题会生成我的“ webClientId”的SHA-1蓝图,但是所有这些问题都使用firebase。在Cognito上,没有字段可添加各自的SHA-1蓝图。
我的代码如下:
componentWillMount() {
GoogleSignin.configure({
webClientId: googleConfig.clientId
});
}
...
googleSignIn() {
GoogleSignin.signIn()
.then((user) => {
console.log(user);
this.setState({user: user});
})
.catch((err) => {
console.log('WRONG SIGNIN', err);
})
.done();
}
...
<GoogleSigninButton
style={{ height: 48 }}
size={GoogleSigninButton.Size.Standard}
color={GoogleSigninButton.Color.Light}
onPress={this.googleSignIn.bind(this)}/>
先谢谢您的帮助。
这是配置不匹配。确保您的android / app / google-services.json是正确的。
您可能需要将SHA证书指纹添加到Firebase配置中。按照此帖子上的说明查找您的SHA1指纹:密钥库证书的SHA-1指纹。然后,转到https://console.firebase.google.com/,选择您的应用程序,然后在“项目设置”(左上角的齿轮图标)下添加SHA1值->您的应用程序-> SHA证书指纹
如果要将配置对象中的webClientId传递给GoogleSignin.configure(),请确保其正确。您可以从Google Developer Console获取webClientId。它们列在“ OAuth 2.0客户端ID”下。
如果您以调试模式运行应用程序而不使用webClientId,或者您确定它是正确的,那么问题可能出在签名(SHA-1或SHA-256)不匹配。您需要将以下内容添加到android / app / build.gradle中:
signingConfigs { debug { if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword MYAPP_RELEASE_STORE_PASSWORD keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword MYAPP_RELEASE_KEY_PASSWORD } } release { if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword MYAPP_RELEASE_STORE_PASSWORD keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword MYAPP_RELEASE_KEY_PASSWORD } } }
那是从这里。
我还在github上找到了这个工作示例。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句