我需要谷歌登录我的反应本机应用程序。所以我谷歌了很多,我发现react-native-google-signin看起来很棒,但我坚持一个错误。反应原生谷歌登录返回状态代码:12501
所有步骤我有以下代码:
componentDidMount() {
GoogleSignin.hasPlayServices({autoResolve: true}).then(() => {
// play services are available. can now configure library
GoogleSignin.configure({
scopes: [
'email', 'profile', 'https://www.googleapis.com/auth/plus.profile.emails.read', 'https://www.googleapis.com/auth/plus.login'
],
webClientId: 'web-clientid from the console developper',
offlineAccess: true
}).then(() => {
// you can now call currentUserAsync()
GoogleSignin.currentUserAsync().then((user) => {
console.log('USER', user);
}).done();
});
});
}
signIn() {
GoogleSignin.signIn()
.then((user) => {
console.log(user);
})
.catch((err) => {
console.log('WRONG SIGNIN', err);
})
.done();
}
render() {
return (
<Image source={BACKGROUND} style={styles.container}>
<Image source={ICON}></Image>
<Text style={styles.welcome}>
APP TEST
</Text>
<GoogleSigninButton
style={{width: 230, height: 48}}
size={GoogleSigninButton.Size.Standard}
color={GoogleSigninButton.Color.Light}
onPress={this.signIn}
/>
</Image>
);
当我登入]按钮点击,弹出一个窗口,我选择哪一个谷歌帐户我想用。但是当我选择的账户中,我有如下错误:错误登录错误:未知状态代码:12501(...)
所以我期待在中Androide Guide 底部野兔的常见问题,并确认我在android/app/google-services.json
certificate_hash是相同的。 我还检查我的app/build.graddle
中的应用ID是否与我在Google云中输入的相同。
我觉得现在的问题是与我通过我的范围WebclientId,我是经过的网络类型之一,但已经尝试了两个客户端ID是在OAuth 2
我在githubs问题搜索,我发现有人告诉再次下载谷歌服务。我这样做,但该文件等于我以前下载的文件。 很确定,我失去了一些东西,但不是什么。 任何人都可以帮助我吗?
我在github中打开一个问题,但我没有得到太多的动作。
在此先感谢
感谢您的帮助。但是我不明白你说的是什么。如何找到隐藏文件,当我不知道名称? – Jacinto
您将不得不调试文件路径的代码并将其检出。 –
他的意思是FAQ - https://github.com/devfd/react-native-google-signin/blob/master/android-guide.md#d-after-the-sign-in-completes-i-get-在跟随误差,错误码12501-什么到做 - – r0ma