'Trying to use GoogleSignIn in React Native then Possible Unhandled Promise Rejection (id: Error: DEVELOPER_ERROR

I've enabled the Google SignIn on Firebase using this link https://rnfirebase.io/auth/social-auth My App compiles fine but when I press the Login button and select a Google account for logging in I get the Possible Unhandled Promise Rejection (id: 0): Error: DEVELOPER_ERROR https://rnfirebase.io/auth/social-auth I have Windows 10 and

react-native-cli: 2.0.1
react-native: 0.63.4
Node : v12.16.0

here is App.js

    import React , {useState , useEffect} from 'react';
    import { Text TextInput, View } from 'react-native';
    import {ButtonTemplate} from '../assets/ButtonTemplate'
    import auth from '@react-native-firebase/auth';
    import { GoogleSignin } from '@react-native-community/google-signin';

    const App = () => {

    useEffect(()=> {
        GoogleSignin.configure({
            webClientId: 'xxxxxxxxxxxxxx.apps.googleusercontent.com',
        });
        })

    async function onGoogleButtonPress() {
            // Get the users ID token
            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
            return auth().signInWithCredential(googleCredential);
        }
    const googleLogin=()=>{
            console.log('Google SignIn');
            onGoogleButtonPress().then(() => console.log('Signed in with Google!'))
            }

    return (
    <ButtonTemplate 
                text={"Continue With Google"} 
                backgroundColor={'#5384ed'}
                fontSize={16}
                marginTop= {'3%'}
                iconText={'G'}
                justifyContent={'flex-start'}
                onPress={googleLogin}
                />
    )
    };

    export default App;

Here is the Error

    Possible Unhandled Promise Rejection (id: 0):
Error: DEVELOPER_ERROR
promiseMethodWrapper@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2258:45
signIn$@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:189098:72
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25048:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25221:32
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25048:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25121:30
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25131:21
tryCallOne@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27134:16
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27235:27
_callTimer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:30674:17
_callImmediatesPass@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:30713:17
callImmediates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:30930:33
__callImmediates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2760:35
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2546:34
__guard@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2743:15
flushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2545:21
flushedQueue@[native code]
callFunctionReturnFlushedQueue@[native code]


Solution 1:[1]

I had Two issues First one is Above and Second was An OAuth2 client already exists for this package name and SHA-1 in another project. Second issues was in Firebase while adding SHA1 in project. I ressolved this issue

  1. Delete debug.keystore
  2. Then regenerated it by this keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 10000
  3. Then Got SHA1 and SHA256 by this command keytool -keystore debug.keystore -list -v after giving password that is located in android/App/build.gradle then signingConfigs there is store password
  4. Added SHA1 and SHA256 in Firebase my project
  5. Download the latest JSON file add that latest JSON in my project android/App folder
  6. then clean gradle by cd android && ./gradlew clean
  7. Uninstall App then do npx react-native run-android
  8. Now its working :)

I used this link How to Implement Google Login in React Native with Firebase also a Youtube video Youtube Video Related Previous Link

Solution 2:[2]

Thank you so much @Shafqat Bari for your answer

If you can't find your debug.keystore inside android/app/ directory make sure you have executed this command keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 10000 inside your android/app/ directory.

Also, if you run the command previously don't run it again instead, see the directory in which you have executed this command and copy the debug.keystore from that place into your android/app/ directory!

Happy Coding!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 HARIHARAN B P