Wednesday 17 March 2021

Unable to Restrict YouTube Data API key to Android App

As the title says I'm having trouble restricting use of the YouTube Data API key by Android App.

What I've done so far:

  • Went on Google Cloud Platform - Restrict API Key page
  • Under Application Restrictions selected Android.
  • Added the item: entered app's package and SHA-1 fingerprint (obtained from Playstore console)
  • Under API restrictions checked "Restrict Key".
  • In the following drop-down selected YouTube Data API V3.
  • Clicked "Save".

Obtaining SHA-1 Fingerprint:

  • On Google Play Console Selected the application.
  • Expanded Setup to open App Integrity.
  • Copied SHA-1 fingerprint from under App signing key certificate.

I now believe I've completed all the steps as outlined in the Applying API Key Restrictions - Google Cloud Platform page. However YouTube Data API calls are still failing with 403. Am I missing something?

Here is my request from debug app: I realize that should fail expectedly but I can't turn on network logging for the current app without pushing an app update.

GET: https://www.googleapis.com/youtube/v3/videos?part=snippet&id=Mkq8pnvsnQg&key=API_KEY

One thing I've noticed is that there are no Android app identifying markers present i.e. no way to tell if it the request was made from Android or any other platform, so maybe I'm missing something there?



from Unable to Restrict YouTube Data API key to Android App

No comments:

Post a Comment