2

It occurs when i choose google account I am working on this error for last 4 days but unable to solve . When i am choose account while using react native google signin after choosing any account it shows DEVELOPER_ERROR in console and alert i even check my sha-1 key both are same in project and firebase project and even re download and use google json file again and check web client id all is fine but error is same i even create a new web credential and use it id but noting work for me what should i do now i spend 4 days on it till now

import React, { useState,useEffect } from 'react';
import { View, StyleSheet, TextInput,Button, TouchableOpacity, Text } from 'react-native'
import {
    GoogleSignin,
    GoogleSigninButton,
    statusCodes,
    } from '@react-native-google-signin/google-signin';

const GoogleLogin = ({navigation}) => {
    const [loggedIn, setloggedIn] = useState(false);
    const [userInfo, setuserInfo] = useState([]);

    useEffect(() => {
      GoogleSignin.configure({
        scopes: ['email'], // what API you want to access on behalf of the user, default is email and profile
        // androidClientId: '429291652902-u76oe5ffntn1m79h10lv56ecm9bq83n1.apps.googleusercontent.com',
        
        webClientId:
          '429291652902-u1cu4i0n83a9cn4pqrh965kvi21odv82.apps.googleusercontent.com', // client ID of type WEB for your server (needed to verify user ID and offline access)
        offlineAccess: true, // if you want to access Google API on behalf of the user FROM YOUR SERVER
      });
     
    }, []);

    const signIn = async () => {
      await GoogleSignin.signOut();
      await GoogleSignin.hasPlayServices();
      await GoogleSignin.signIn()
      .then((response) => {
          console.log("ye aya google ka response", response);
          setisloading(true);
          const body = {
            email: response?.user?.email,
            socialId: response?.user?.id,
            phoneNumber: "",
            FCMtoken: FCM,
          };
          checkUserExistence(body);
        })
        .catch((err) => {
          console.log(err);
          alert(err.message);
          if (err.code === statusCodes.SIGN_IN_CANCELLED) {
          } else if (err.code === statusCodes.IN_PROGRESS) {
            
          } else if (err.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
          } else {
          }
        });
    };

     const signOut = async () => {
        try {
          await GoogleSignin.revokeAccess();
          await GoogleSignin.signOut();
          setloggedIn(false);
          setuserInfo([]);
        } catch (error) {
          console.error(error);
        }
      };

    return (
        <View style={styles.container}>
           
           <GoogleSigninButton
                style={{width: 192, height: 48}}
                size={GoogleSigninButton.Size.Wide}
                color={GoogleSigninButton.Color.Dark}
                onPress={()=>signIn()}
              />

{!loggedIn && <Text>You are currently logged out</Text>}
              {loggedIn && (
                <Button
                  onPress={()=>signOut()}
                  title="LogOut"
                  color="red"></Button>
              )}
        </View>
    )
}
const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        padding: 10,
        marginTop: 100,
    },
   
});

export default GoogleLogin;
  • 1
    Hey, Checkout this tutorial, https://youtu.be/62kUy0-0x4s Maybe you are missing something. – Vishal Pawar Dec 10 '22 at 05:15
  • it gives error when i change the debug store file file and key store error is *Execution failed for task ':app:validateSigningDebug'. > Keystore file 'E:\ReactNativeSocialLogins\android\app\firebase.keystore' not found for signing config 'debug'.* – Junaid Anwar Dec 12 '22 at 06:02
  • Have you tried out the different solutions listed here : https://stackoverflow.com/questions/54417232/react-native-google-signin-gives-developer-error? – ade19 Dec 12 '22 at 14:56
  • 1
    You can simple create a firebase,keystore file at project/android/app. or add a signin config and rename firebase.keystore to debug or something which is already present in your app folder. in - > app/build.gradle -> signingConfigs ``` signingConfigs { debug { storeFile file('firebase.keystore') //or storeFile file('debug.keystore') storePassword 'android' keyAlias 'fbalias' keyPassword 'android' } } ``` – Vishal Pawar Dec 18 '22 at 09:05

0 Answers0