YouTube Api - Could not search: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden

醉酒当歌 提交于 2019-12-30 11:14:08

问题


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.



来源:https://stackoverflow.com/questions/28356313/youtube-api-could-not-search-com-google-api-client-googleapis-json-googlejson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!