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
After spending some time I figure it out what was the problem with Google sign in and why this error was throwing when I do Google sign in.
So here is the solution for this: In my case, I have published the apk on google play store and I have selected Google play app signing what that does it will create new certificate keystore for security purpose and the old keystore get invalid (https://support.google.com/googleplay/android-developer/answer/7384423) and you have added SHA1 in firebase for old keystore not for new one which is created by Google. So when you try logging in through google then it throws this error.
So i figure it out: Go to your Google play console(https://play.google.com/apps/publish/) > Select the App (on the left menu) > Release Management > App signing
You will see two app signing certificate one is your old uploaded keystore certificate and another one is the newly created app signing certificated created by google play. So copy the SHA1 and SHA256 key from App signing certificate and paste the same key in Firebase console (https://console.firebase.google.com) > Select your project > select app setting > General (Select your app package) > and paste the both SHA1 and SHA256 key and save and you are done.
Restart the app and it will work. It works in my case ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With