【问题标题】:Google Client API connection error on some servers某些服务器上的 Google Client API 连接错误
【发布时间】: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


    【解决方案1】:

    我已经通过清除 Google 开发者控制台中的允许 IP 字段解决了我自己的问题。

    通过将此字段保留为空,它允许任何 IP。偶然发现的。

    我仍然不知道这是怎么回事,即使我 100% 确定我使用了正确的 IP 地址,但它却给了我这个错误。

    【讨论】:

      猜你喜欢
      • 2018-06-12
      • 2013-07-19
      • 1970-01-01
      • 2015-08-28
      • 1970-01-01
      • 2012-10-06
      • 1970-01-01
      • 1970-01-01
      • 2021-04-01
      相关资源
      最近更新 更多