YouTube Api - Could not search: com.google.api.cli

2019-02-19 09:51发布

问题:

I have been following this tutorial to create Youtube application.. I created Browser-Android API Key and tried both of them in my project.. But when I try to run it and search I get:

Could not search: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
   "code" : 403,
   "errors" : [ {
     "domain" : "usageLimits",
     "message" : "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
     "reason" : "ipRefererBlocked",
     "extendedHelp" : "https://console.developers.google.com"
   } ],
   "message" : "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
 }

Any Idea..?

回答1:

All you've to do is : Remove/Edit Referers to "Any referer allowed" from the section of "Key for browser applications" .



回答2:

Problem fixed by setting the referers of the browser api to any referer allowed.



回答3:

Setting it to "Any referer allowed" is easy as erasing all referer allowed inputs.