UNREGISTERED_ON_API_CONSOLE while getting OAuth2 token on Android
Well, I finally figured it out. Not sure if I misread the documentation or if there are missing links, but anyway.
Fact is that when you sign a APK and then ask Google for a OAuth2 token, you have to register your signed app through the dev console. It's a security measure based on the app package name and the sha1 fingerprint.
To do that, you have to :
- sign your APK, manually or through Gradle or whatever: the Android documentation is pretty clear on this step;
- get your sha1 fingerprint; as mention in this SO answer, it's kind of easy on Android Studio: in the Gradle panel, select the
signingReport
task under your root project and run it - the SHA1 fingerprint will show in the text output; - register your APK through the Google dev console: create a new Credentials / OAuth client id / Android, defined by the SHA1 fingerprint you got and your APK package name.
And voila!
For information, the only official documentation I found explaining the why and how of the two final steps is here:
https://developers.google.com/drive/android/auth
Android [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
I answered this in my other post here
Looks like when I create credentials keys in the API manager Google console, it doesn't add the SHA1 keys in all the apps of the project in Firebase.
All I had to do (after a week of hard work) was to copy paste the SHA1 from tha app "linked" to the Google API console in the other app
I hope it can help
com.google.android.gms.auth.GoogleAuthException: UNREGISTERED_ON_API_CONSOLE
The issue is that, when you debug, you're using a keystore created in ~/.android/debug.keystore, and not whatever signing key you think you're using.
When you generate a key, such as to release a signed APK, you think that this SHA1 is the one required by the Google API interface. It isn't.
If you replace the one in the ~/.android folder with your signing key, it's corrupt because it's missing the androiddebugkey. FYI, the default password for the auto-generated key is "android".
For directions as to where your keystore is located, see https://developer.android.com/studio/publish/app-signing.html under "Expiry of the debug certificate".
What you have to do:
1) Delete your debug.keystore and restart your IDE. This should generate a new debug.keystore with key alias "androiddebugkey".
2) If your IDE does not generate the new keystore, re-run your android application. It should generate it this time in ~/.android/
3) Navigate to /path/to/jre/bin and add this path to your system environment variables. This will allow you to access keytool
.
4) Navigate to the directory of your debug keystore and run this command: keytool -list -keystore debug.keystore -alias androiddebugkey
5) Your console will prompt you to enter the keystore password (it is "android").
6) Get the SHA1 key from the keystore and put THAT KEY into your API interface, and you'll find it works.
Google Play Games Services UNREGISTERED_ON_API_CONSOLE
First of all go to google play console .. select your app .. and go to app signing under release management. you will find two certificates here .
1. app signing certificate
2. upload certificate
from here you will need the app signing SHA-1 certificate.copy it .
now go to google api console. you will find your game there select it . you will find that the sha1 here is identical to the sha1 of your upload certificate . but you need to paste your signing sha1 certificate here . and you will be all good to go. hope it will help.
Related Topics
Padding Between Actionbar's Home Icon and Title
Access Pictures from Pictures App in My Android App
Android - Apply Selectableitembackground in Xml with Support V7
Migration from Gcm to Fcm Needed
Android:What Is Difference Between Setflags and Addflags for Intent
Difference of Setvalue() & Postvalue() in Mutablelivedata
Android Device Chooser -- Device Not Showing Up
How to Change the Track Color of a Switchcompat
Error: Execution Failed for Task ':App:Clean'. Unable to Delete File
How Do We Distinguish Never-Asked from Stop-Asking in Android M's Runtime Permissions
Android Alert Dialog with One, Two, and Three Buttons
How to Open Private Files Saved to the Internal Storage Using Intent.Action_View
How to Create a Multilingual Android Application
How to Click or Tap on a Textview Text on Different Words
Sending Mail in Android Without Intents Using Smtp