Я пытаюсь войти в систему с помощью Google в сборке моего проекта в React-native. Я тестирую его на реальном устройстве Android. Но при входе в систему выдается ОШИБКА РАЗРАБОТЧИКА. Я добавил сертификат SHA 1 debug.keystore, сформированный в каталоге android/app проекта, в настройки проекта в консоли Firebase.
import { GoogleSignin } from '@react-native-community/google-signin';
import auth from '@react-native-firebase/auth';
const GoogleLogin = () => {
useEffect(() => {
GoogleSignin.configure({
webClientId: '************************', // From Firebase Console Settings
});
}, [])
async function onGoogleButtonPress() {
console.log('i am running on google login function')
// Get the users ID token
const { idToken } = await GoogleSignin.signIn();
console.log('idToken :', idToken)
// Create a Google credential with the token
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
// Sign-in the user with the credential
return auth().signInWithCredential(googleCredential);
}
const handleSignIn = () => {
onGoogleButtonPress()
.then(() => {
console.log('Signed in with google.')
})
.catch((err) => console.log('error while signing in with Google:', err))
}
return (
)
}
Я пытаюсь войти в систему с помощью Google в сборке моего проекта в React-native. Я тестирую его на реальном устройстве Android. Но при входе в систему выдается ОШИБКА РАЗРАБОТЧИКА. Я добавил сертификат SHA 1 debug.keystore, сформированный в каталоге android/app проекта, в настройки проекта в консоли Firebase.
ОШИБКА:
Это изображение ошибки
Вот как я это реализую.
[code]import { GoogleSignin } from '@react-native-community/google-signin'; import auth from '@react-native-firebase/auth';
async function onGoogleButtonPress() { console.log('i am running on google login function') // Get the users ID token const { idToken } = await GoogleSignin.signIn(); console.log('idToken :', idToken)
// Create a Google credential with the token const googleCredential = auth.GoogleAuthProvider.credential(idToken);
// Sign-in the user with the credential return auth().signInWithCredential(googleCredential); }
const handleSignIn = () => { onGoogleButtonPress() .then(() => { console.log('Signed in with google.') }) .catch((err) => console.log('error while signing in with Google:', err)) }