【发布时间】:2015-01-25 15:47:12
【问题描述】:
我正在使用最新版本的 Google 客户端 PHP 来从 YouTube 获取数据。
我从 Google 开发者控制台(旧版和新版)创建了一个服务器 API 密钥,启用了 Youtube API 并将我的个人 IP 列入白名单以允许访问 API。这没有任何问题!
奇怪的是,当我在我的(在线)服务器上运行代码时,我不断收到此错误:
[domain] => usageLimits
[reason] => accessNotConfigured
[message] => Access Not Configured. The API is not enabled for your project, or 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 configuration.
[extendedHelp] => https://console.developers.google.com
我尝试在不同的在线服务器上运行代码,同时将它的 IP 列入白名单,但它一直给我这个错误。当我尝试从我自己的计算机上使用不同的 IP(家庭、工作、邻居)运行代码时,它也会给我同样的错误,但是在我将当前 IP 列入白名单后,错误就会消失。所以白名单似乎解决了这个问题,但只在我的本地机器上,而不是在任何在线服务器上。
我已经尝试生成新的 API 密钥,但没有任何运气。我还尝试附加 userIp 参数,如控制台文档中提供的那样。还是没有运气。
我没有想法。有人知道可能出了什么问题吗?
【问题讨论】:
标签: php youtube-api google-api-php-client google-client