首页 > 解决方案 > Youtube 数据 API 密钥停止工作。获取 accessNotConfigured 错误

问题描述

一年多来,我们一直在使用简单的 API 密钥通过内部开发的 Moodle 插件获取公共 Youtube 视频。今天,我意识到这个键在开发新功能时不再起作用。使用浏览器中的密钥确保问题不是来自我的代码,我收到 accessNotConfigured 错误。该密钥仅用于从 Youtube 获取公共数据。

我尝试了这里找到的所有关于重新生成密钥并确保没有限制的解决方案。另请注意,创建此 Youtube 帐户只是为了使用此密钥,一年多来没有人登录或更改此帐户的任何内容。

我注意到一个非常奇怪的事情是我的每日配额为 0。当我尝试更改它时,它说“输入一个介于 0 和 0 之间的新配额限制。”。漏洞?

检查过去 48 小时的历史记录,有 49 个请求(全部为今天),错误率为 100%。

Youtube Data API v3 一直被激活,但为了更好的措施,我还激活了其他与 Youtube 相关的 API。

尝试此浏览器内请求时出现错误:https ://www.googleapis.com/youtube/v3/videos?part=player&id=nl9q1qbDSHo&key=API_KEY

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. YouTube Data API has not been used in project {ID} before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project={ID} then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "extendedHelp": "https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project={ID}"
   }
  ],
  "code": 403,
  "message": "Access Not Configured. YouTube Data API has not been used in project {ID} before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project={ID} then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
 }
}

...并从 PHP @file_get_contents() 请求中得到错误的响应(我强调,这一直有效到今天)。

最近这个 API 是否发生了任何变化,可能导致这种新的莫名其妙的行为?从 API 获取数据是/应该尽可能直接。不知道我还能尝试什么。

标签: youtubeyoutube-apiyoutube-data-apiapi-key

解决方案


再也没有让这个工作了。删除/重新创建新键,停用/激活 API,直到我的手指流血。

通过从头开始删除并重新创建一个新项目,然后是新密钥,让它再次工作(最终取消了 0 天的配额)。

我希望这些浪费在我生命中的时间回到谷歌。


推荐阅读