Closed FloreaMaria closed 1 month ago
Hello and thanks for asking, please read more here https://react-native-google-signin.github.io/docs/troubleshooting#developer_error-or-code-10-or-developer-console-is-not-set-up-correctly-error-message Thank you 🙂
So I'm trying to use Google Sign In with Firebase This is my code:
` GoogleSignin.configure({ androidClientId: "myAndroidCliendId", });
export async function googleSignIn() { try { await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true }); const { idToken, accessToken } = await GoogleSignin.signIn({ prompt: "select_account", }); const googleCredential = auth.GoogleAuthProvider.credential(idToken, accessToken); const userSignIn = await auth().signInWithCredential(googleCredential);
} catch (error) { console.log("Error during login (function):", error); } }`
This is my Login Screen: `import { TouchableOpacity, StyleSheet, View, Text, Image } from "react-native"; import React, { useContext, useState } from "react";
import { AuthContext } from "../contexts/AuthProvider"; import { storeUserData, fetchUserData } from "../firebase/users"; import { googleSignIn } from "../firebase/googleSignIn"; import LoadingOverlay from "../components/LoadingOverlay"; import SignInAnonymously from "../components/SignInAnonymously";
function SignInScreen() { const [isFetching, setIsFetching] = useState(false); const authContext = useContext(AuthContext);
async function onGoogleButtonPress() { try { setIsFetching(true); const userSignIn = await googleSignIn();
} if (isFetching === true) return ;
return (
); }
const styles = StyleSheet.create({
container: { flex: 1, backgroundColor: "whitesmoke", alignItems: "center", }, signInContainer: { marginTop: 30, alignItems: "center", }, button: { // backgroundColor: 'white', padding: 10, borderRadius: 5, marginTop: 50, }, buttonText: { fontSize: 25, fontFamily: "Arial", // fontWeight: "bold", }, });
export default SignInScreen; `
I get:
LOG Error during login (function): [Error: DEVELOPER_ERROR] LOG undefined LOG Error during login: [TypeError: Cannot read property 'user' of undefined]
Environment
Please help!