google-cloud-java icon indicating copy to clipboard operation
google-cloud-java copied to clipboard

YouTube Data API restriction gives error code 403

Open clickokiemute opened this issue 5 years ago • 1 comments

Hello guys. I built an app that makes use of YouTube Data API. When building, i discovered that if i restrict my API Key to Android applications, it gives me this error:-

{ "error": { "code": 403, "message": "Requests from this Android client application \u003cempty\u003e are blocked.", "errors": [ { "message": "Requests from this Android client application \u003cempty\u003e are blocked.", "domain": "global", "reason": "forbidden" } ], "status": "PERMISSION_DENIED" } }

But if i set restriction to "None", the API calls brings back a good JSON response. So i left application restriction at "None". Now i want to upload to Google Play Console and i get the alert to restrict my API.

Please, how do i handle this?

clickokiemute avatar Jun 24 '20 18:06 clickokiemute

I was able to find a solution on stackoverflow by Ayman Al-Absi that shows you how to pass your SHA-1 certificate information: https://stackoverflow.com/questions/39543105/youtube-api-key/39747334

I also added restrictions to my API key by providing my SHA-1 signing-certificate fingerprints on the Google APIs console. Hopefully this helps.

colorgold avatar Jan 24 '21 05:01 colorgold