Error: DEVELOPER_ERROR with firebase google sign in with react native

Viewed 2103

I am implementing firebase social login in my react native app, this problem it has been asked many times and I have followed all what in other question but nothing worked at all, here what I did:

  1. generate Certificate fingerprint from my project based on this docs using cd/android && ./gradlew signingReport and copy SHA1 of the following Variant information:

Variant: debug Config: debug Store: C:\Users\USER-NAME\PROJECT-NAME\android\app\debug.keystore then paste it in firebase under my registered android app.

  1. Download json file and added it to Android/app Directory
  2. Enable google sign In provider in firebase.

4.I have checked the oauth_client/client_id in json file which same is the auto generated one in google console OAuth 2.0 Client IDs

  1. I have added support email in firebase public project information.

  2. all required pre setup for firebase has been done based on this docs

  3. package name when create new app in firebase is same as the name in AndroidManifest.xml

  4. In OAuth in google developers console the app name is same as the name in AndroidManifest.xml

  5. I have rebuild the app several times but still the error occurs.

my code looks like the following:

googleLogin: async () => {
                try {
                    GoogleSignin.configure({
                        webClientId: "542246894154-fgfa3e4b3maonkftkvkd1lvrueda7iop.apps.googleusercontent.com",
                        offlineAccess: true
                    });
                    const data = await GoogleSignin.signIn();
                    const credential = firebase.auth.GoogleAuthProvider.credential(data.idToken, data.accessToken);
                    const firebaseUserCredential = await auth().signInWithCredential(credential);
                    if (firebaseUserCredential) setLoggedInGoogle(true);
                    if (typeof success === 'function') success();

                } catch (error) {
                    if (error.code === statusCodes.SIGN_IN_CANCELLED) {
                        // when user cancels sign in process,
                        Alert.alert('Process Cancelled')
                    } else if (error.code === statusCodes.IN_PROGRESS) {
                        // when in progress already
                        Alert.alert('Process in progress')
                    } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
                        // when play services not available
                        Alert.alert('Play services are not available')
                    } else {
                        // some other error
                        Alert.alert('Something else went wrong... ', error.toString())
                        setError(error)
                    }
                }


            }

I will really appreciate any help as I am stuck in this almost 4 hours with same error.

0 Answers
Related