5

I developed a React Native app, and I am using Expo Google-Sign-In for my Firebase authentication. I receive the error "DEVELOPER_ERROR" when I attempt authentication on my standalone APK on Android.

Initially, I was using "Expo Google", however that is now deprecated and my sign-in button did not do anything on my standalone APK. With Expo Google method, I found that I had to set the androidStandaloneAppClientId. Even after that, the sign-in got stuck at the Google homepage after authentication. I tried the solution of using a custom redirect URI, as in

redirectUrl: ${AppAuth.OAuthRedirect}:/oauth2redirect/google

but that resulted in another error: redirect_uri mismatch.

I switched to the Expo Google-Sign-In library instead, and that is giving me a DEVELOPER_ERROR every time I try to authenticate.

After that, I have tried:

  • downloading the google-services.json and using it in my app
  • setting the SHA1 fingerprint in google-services.json and in Firebase
  • setting the certificateHash inside android.configuration.certificate hash inside my app.json to my SHA1 fingerprint.
  • checking and making sure package names are set properly

I tried anything else I may have failed to mention from the existing threads involving DEVELOPER_ERROR in Expo Google-Sign-In.

The variables I mention in my code below are from the following:

SHA1 was generated and used to create my credential, and is the fingerprint used in my OAuth Android Client ID.

The client ID I reference throughout my files is the ID of my OAuth Web client ID. However, I also tried using the Android one and that did not change anything.

"CurrentKey" in api_key is the API key from my Firebase project.

This is a link to my Google Credentials page.

https://i.stack.imgur.com/MVfO2.jpg

/* My app.json: */

{
  "expo": {
    "name": "AssistiveNote",
    "privacy": "public",
    "description": "A note app for people who have trouble reading text.",
    "slug": "assistivenote",

    "sdkVersion": "33.0.0",
    "version": "2.0.0",
    "orientation": "portrait",
    "icon": "./screens/images/icon.png",


    "ios": {
      "bundleIdentifier": "com.danyalbabar.assistivenote"
    },

    "android": {
      "versionCode": 2,
      "package": "com.danyalbabar.assistivenote",
      "googleServicesFile": "./google-services.json",
      "permissions": [ " " ],
      "config": {
        "googleSignIn": {
            "certificateHash": "XXXX"
        }
      }
    }

  }
}

My google-services.json:

  {
  "project_info": {
    "project_number": "XXXX",
    "firebase_url": "https://era-gvision.firebaseio.com",
    "project_id": "era-gvision",
    "storage_bucket": "era-gvision.appspot.com"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "XXXX",
        "android_client_info": {
          "package_name": "com.danyalbabar.assistivenote"
        }
      },
      "oauth_client": [
        {
          "client_id": "XXXX",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "XXXX"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "XXXX",
              "client_type": 3
            }
          ]
        }
      }
    }
  ],
  "configuration_version": "1"
}
DanyalBabar
  • 71
  • 1
  • 4

4 Answers4

3

eas November 2022 update (android)

If you are using eas and getting DEVELOPER_ERROR:

  • run eas credentials (follow the steps to get your SHA1)
  • Add the SHA1 to your android app in the firebase console (https://console.firebase.google.com/project/YOUR_FIREBASE_APP_ID/settings/general/)
  • download the google-services.json (same URL from above) and place it inside your project folder
  • update your app.json to include expo.android.googleServicesFile: "./path/to/google-services.json"
  • Also inside the app.json: double check that the expo.android.package matches the package from the googleServicesFile
  • Make sure to initialize the google sign without any arguments for android GoogleSignin.configure()

If it still doesn't work

pedrobern
  • 1,134
  • 9
  • 24
  • 1
    The exact answer I was looking for. I tried various SHA 1 keys but none worked. Until I used the one from eas credentials. Thank you for sharing – David Jan 03 '23 at 23:53
2

This is configuration mismatch. Make sure that your android/app/google-services.json is correct.

You may need to add your SHA certificate fingerprint to your Firebase config. Find your SHA1 fingerprint by following the instructions on this post: SHA-1 fingerprint of keystore certificate. Then, go to https://console.firebase.google.com/, select your app, and add the SHA1 value under Project Settings (gear icon in the upper left) -> Your Apps -> SHA certificate fingerprints

If you're passing webClientId in configuration object to GoogleSignin.configure() make sure it's correct. You can get your webClientId from Google Developer Console. They're listed under "OAuth 2.0 client IDs".

If you're running your app in debug mode and not using webClientId or you're sure it's correct the problem might be signature (SHA-1 or SHA-256) mismatch. You need to add the following to android/app/build.gradle:

signingConfigs {
  debug {
       storeFile file(MYAPP_RELEASE_STORE_FILE)
       storePassword MYAPP_RELEASE_STORE_PASSWORD
       keyAlias MYAPP_RELEASE_KEY_ALIAS
       keyPassword MYAPP_RELEASE_KEY_PASSWORD
  }
  release {
       ...
  }
IdleWork
  • 21
  • 1
  • I've tried all the fingerprints many times, and I am almost certain they are correct. However, I am unsure how to go about your suggestion with editing the build.gradle file. The thing is, I don't have any "grade" files or "android" folders within my React Native project. I am also developing in Visual Studio Code, not Android Studio. If you have any suggestions as to how I can convert my project so that I can access this build.gradle file, I would like to try your suggestion. – DanyalBabar Aug 31 '19 at 23:03
0

In my case, I had to pass in androidClientId and webClientId to the configure method,

      GoogleSignin.configure({
        webClientId: '',
        androidClientId:'',
      });

In order to get the credentials, select your project on this page https://console.cloud.google.com/apis/credentials

-1

Overall it seemed like there was a lot of broken behaviour with this API and it is now deprecated. I moved on to use email/password authentication at the time, but there are now updated Expo APIs that are implemented in new ways.

https://docs.expo.io/guides/authentication/

DanyalBabar
  • 71
  • 1
  • 4