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;