E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE

Viewed 11533

I am using Google Sign In via Firebase in my app. But while running the published app from Play Store, it shows following error.

E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE

All though I have registered on Firebase, and API Console, with ids mentioned in JSON file. Following is the JSON File code

{
  "project_info": {
  "project_number": "311816357497",
  "firebase_url": "https://mcqsce.firebaseio.com",
  "project_id": "mcqsce",
  "storage_bucket": "mcqsce.appspot.com"
},
"client": [
{
  "client_info": {
    "mobilesdk_app_id": "1:311816357497:android:494b736XXXX6010b",
    "android_client_info": {
      "package_name": "in.readhere.mcqceit"
    }
  },
  "oauth_client": [
    {
      "client_id": "311816357497-9ma34c4qXXXXXXXXXXXXXoep8b24u8g.apps.googleusercontent.com",
      "client_type": 1,
      "android_info": {
        "package_name": "in.readhere.mcqceit",
        "certificate_hash": "6847ce9f7e38dc588d12345678f21c13bd25ea7c"
      }
    },
    {
      "client_id": "311816357497-5lbqnmj0bxxxxxxxxxxxxxm4qjfhmq06.apps.googleusercontent.com",
      "client_type": 3
    }
  ],
  "api_key": [
    {
      "current_key": "AIzaSyC6BGtRfxxxxxxxxxGrwwe_0V3uY9g-0dI"
    }
  ],
  "services": {
    "analytics_service": {
      "status": 1
    },
    "appinvite_service": {
      "status": 2,
      "other_platform_oauth_client": [
        {
          "client_id": "311816357497-5lbqnmj0bxxxxxxxxxxxxxxm4qjfhmq06.apps.googleusercontent.com",
          "client_type": 3
        }
       ]
     },
     "ads_service": {
       "status": 2
     }
   }
 }
 ],
 "configuration_version": "1"
}

Following is the API Console for app firebase console

api console

7 Answers

The complete recipe:

  1. As the other answers, make sure that your actual signed Android apk has the same SHA fingerprint as what you specified in the console of your Firebase project's Android integration section (the page where you can download the google-services.json)
  2. On top of that go to the Settings of your firebase project (gear icon right to the Overview at the top-left area. Then switch to Account Linking tab. On that tab link the Google Play to your project.

And voila! Hopefully your problem will be solved.

You need a SHA1 fingerprint for debug app and another one for release. Run this in a terminal to get the release fingerprint:

keytool -exportcert -list -v -alias <your-key-name> -keystore <path-to-production-keystore>

You will need your keystore password (the one you use to generate a signed APK). Then go to https://console.firebase.google.com/project/_/settings/general/ and add the new fingerprint

I was having the same problem when trying to sign in with Google on a published app, and this fixed the problem

Related