YouTube Data API restriction gives error code 403
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?
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.