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:
- Navigated to my
C:\Program Files\Java\jre1.8.0_101\bin
directory and opened this location in a terminal window. - Input the following command
keytool -list -v - keystore "C:\Users\[PATH_TO_ANDROIDDEBUGKEY].keystore"
. Used android as the password. - On the API Console :
- Created Credentials, and for key restriction, selected Android Apps
- Copied the SHA-1 fingerprint and pasted into the API Console. Also typed in my applications package name (found in my AndroidManifest.xml file).
- Saved settings.
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
- Generated my owned signed APK and keystore. I followed the same steps provided above (changing the keystore path) to obtain the SHA-1 fingerprint and pasted into the API Console ---> Did not resolve
- Created an entirely new API Key and followed the steps provided above ---> Did not resolve
- Used this terminal command instead to obtain the SHA-1 Fingerprint :
keytool -exportcert -alias androiddebugkey -keystore [path-to-debug-or-production-keystore] -list -v
---> Did not resolve - Ensured the Youtube Data API v3 is enabled on the API Manager Dashboard ---> Did not resolve
Can 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?