How to include package name & SHA1 when using YouTube Data API

53 views
Skip to first unread message

Ashraf Alshahawy

unread,
Sep 12, 2017, 5:45:29 PM 9/12/17
to google-api-java-client
My application needs fall under using Public API Key, I don't need OAuth

I created an API Key under my developer console

I tested it and I receive the data I need from YouTube

When I restricted my key - As recommended by Google - to Android App and provided both package name and signing key SHA1 fingerprint (For debug key & release key), only then my calls failed, with an error response is below:

I searched around as much as I could, and the logical answer I came by is that I need to send my package name & my application SHA1 along with my YouTube Data API request to get verified against the ones I provided under my developer console.

I couldn't find an example to do that using YouTube Data APIs, could you please provide a code sample.

Thank you in advance.

 
final GsonFactory mJsonFactory = new GsonFactory ();
final HttpTransport mTransport = AndroidHttp . newCompatibleTransport ();

 
mYoutubeDataApi = new YouTube . Builder ( mTransport , mJsonFactory , null ). setApplicationName ( getResources (). getString ( R . string . app_name )). build ();

Reply all
Reply to author
Forward
0 new messages