Problemas con la autenticación de Google - GoogleClientId - WebClientId en React Native

Viewed 38

I'm making my app in Expo and I decided to authenticate with Google so I used the command "npx create-expo-app --template bare-minimum" to be able to use native code. I followed the steps of Firebase -> "**https://rnfirebase.io/**". When I change the code for "webClientId" I get this warning "Possible Unhandled Promise Rejection (id: 0):" and when I click the button it doesn't load the modal instead when I change to "androidClientId" I get this message "must specify an idtoken or an access token" What is my error?

import { StatusBar } from "expo-status-bar";
import React, { useEffect } from "react";
import { StyleSheet, Text, View, Button } from "react-native";
import {
  GoogleSignin,
  statusCodes,
  GoogleSigninButton,
} from "@react-native-google-signin/google-signin";
import auth from "@react-native-firebase/auth";

export default function App() {
  useEffect(() => {
    GoogleSignin.configure({
      androidClientId: //webClientId
        "xxx.apps.googleusercontent.com",
    });
  }, []);

  const signIn = async () => {
    try {
      const { idToken } = await GoogleSignin.signIn();
      const googleCredential = auth.GoogleAuthProvider.credential(idToken);
      return auth().signInWithCredential(googleCredential);
    } catch (error) {
      console.log(error);
    }
  };

  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />

      <Button
        title="Iniciar sesion"
        onPress={signIn}
      />
    </View>
  );
}

const styles = StyleSheet.create({
 ...
});
0 Answers
Related