我需要谷歌登錄我的反應本機應用程序。所以我谷歌了很多,我發現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