I am getting same problem again and again for last 10 days. I am using React Native CLI and trying to achieve Social Logins through Firebase.
Here's my main app.js file
import { Button, StyleSheet, Text, View } from 'react-native'
import React from 'react'
import auth from '@react-native-firebase/auth';
import { GoogleSignin } from '@react-native-google-signin/google-signin';
export default function App() {
GoogleSignin.configure({
webClientId: '22141653705-prn44vqplfc5gnnvta1agv60mqb59tht.apps.googleusercontent.com',
});
const signInWithGoogleAsync = async () => {
// Get the users ID token
try{
const { idToken } = await GoogleSignin.signIn();
// Create a Google credential with the token
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
// Sign-in the user with the credential
const user_sign_in = auth().signInWithCredential(googleCredential);
user_sign_in.then((user) => {
console.log(user);
})
.catch((error)=>{
console.log(error);
})
}
catch(error){
console.log(error);
}
}
return (
<View style={{flex:1,justifyContent:'center',alignItems:'center'}}>
<Button title="Sign in with Google" onPress={signInWithGoogleAsync} />
</View>
)
}
const styles = StyleSheet.create({})
Here's my google-services.json file
{
"project_info": {
"project_number": "22141653705",
"project_id": "rn-firebase-c65e0",
"storage_bucket": "rn-firebase-c65e0.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:22141653705:android:412f6758b9a9e4c400b318",
"android_client_info": {
"package_name": "com.testfirebase"
}
},
"oauth_client": [
{
"client_id": "22141653705-jmmnfqj5g1vsjd10b3aneobfqopcdas0.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.testfirebase",
"certificate_hash": "203e8b51da549d3be63bb70183478696cda25b5f"
}
},
{
"client_id": "22141653705-prn44vqplfc5gnnvta1agv60mqb59tht.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyD2pTmhBUQA4ZtT6WEBuG88wAdnmY8Mw1Q"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "22141653705-prn44vqplfc5gnnvta1agv60mqb59tht.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
Here are my screenshots for SHA keys and other configurations: SHA 1 keys of debug Android Test