“403 - usageLimits” on youtube api

我只是一个虾纸丫 提交于 2020-01-03 13:05:10

问题


I have this JSON response from my call from my android App to YouTube API:

"error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "ipRefererBlocked",
    "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.",
    "extendedHelp": "https://console.developers.google.com"
   }
  ],
  "code": 403,
  "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."
}

My url is correct (acoording to youTube search list)

I read somewhere that I should send a browser-key and NO an android-key, but it doesn't work.


回答1:


The error seems clear to me:

Your URL is good, but you just exceeded your quota on Youtube API.

There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions.

I believe this is still true:

Version 3 of the YouTube Data API has concrete quota numbers listed in the Google API Console where you register for your API Key. You can use 30,000 units/second/user and 50,000,000 per day.




回答2:


The reason is explained in the response you got:

Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.

Your request was blocked because it came from an IP address that didn't match the IP restrictions for that key. I don't know if you're using a browser or server key. I created a server key and I use it to test both with my browser as well as my server. After creating the server key check the 'allowed IPs' option on the API Access tab and make sure its blank to allow for all IPs that provide a valid key. Likewise, if you're using a browser key check the 'allowed referrers' and make sure its blank: https://code.google.com/apis/console/?noredirect




回答3:


  1. You may remove domain restrictions from "Accept requests from these HTTP referrers (web sites)", if you have added one. Once its working you can add DOMAIN name restriction later. Also Domain ownership validation process is needed, if Domain restrictions are added.

  2. generate and use "browser" type key, if integrating to a website/ webpage.

thanks.



来源:https://stackoverflow.com/questions/30081163/403-usagelimits-on-youtube-api

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