In my application, I am attempting to fetch Channel data, such as total number of video uploads and subscriber count. However, when running my application, I encounter the following error:
E/Service Error:: 403 : The request did not specify any Android package name or signing-certificate fingerprint. Please ensure that the client is sending them or use the API Console to update your key restrictions.
As far as obtaining OAuth Credentials, I have followed several guides, including the guides provided on the Google Developers webpage:
C:\Program Files\Java\jre1.8.0_101\bin
directory and opened this location in a terminal window.keytool -list -v - keystore "C:\Users\[PATH_TO_ANDROIDDEBUGKEY].keystore"
. Used android as the password.I copied the API key into my application, and always access it statically. ie:
youtube = new YouTube.Builder(...).setYouTubeRequestInitializer(new YouTubeRequestInitializer(Config.YOUTUBE_API_KEY)).setApplicationName("MY_APPLICATION_NAME").build();
YouTube.Channels.List query = youtube.channels().list("statistics");
query.setKey(Config.YOUTUBE_API_KEY);
query.setFields("items(statistics(subscriberCount,videoCount))");
ChannelListResponse response = query.execute();
So I have no idea why I am encountering the error above when I have completed the steps correctly? This issue was previously discussed here, but the answer selected is not what I was expecting, as I would like to have Key Restriction.
Other Steps I Have Taken to Resolve the Service Error
keytool -exportcert -alias androiddebugkey -keystore [path-to-debug-or-production-keystore] -list -v
---> Did not resolveCan anyone please provide an answer as to why I am receiving a Service Error if I have followed the credential steps listed in the guides?
Well, I don't know if this is a bug or not. But according to this thread it might be a bug in the Google System. The only workaround that I see in the internet for this issue is by using a Browser key instead of Android key. If you have time, try also to check this SO question about Restricting usage for an Android key