Youtube API v3 显示“未配置访问" [英] Youtube API v3 shows "Access Not Configured"

查看:34
本文介绍了Youtube API v3 显示“未配置访问"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发者控制台中创建了一个 Google 应用,打开了YouTube Data API v3",生成了服务器 API 密钥,并授权了我的家庭和工作 IP.

I created a Google application in the developers console, turned on "YouTube Data API v3", generated the server API key, and authorized my home and work IPs.

我的网站使用 V3 API 列出了来自 Youtube 频道的所有视频.它使用 官方 PHP 库,将服务器 API 密钥传递给它.

My website lists all videos from a Youtube channel, using the V3 API. It uses the official PHP library, passing it the server API key.

昨天在家一切顺利,今天早上下班.然后,它在上午 11 点(GMT+1)突然停止工作,我没有采取任何行动,并出现以下错误:

It all worked well yesterday from home, and today morning from work. Then, it suddently stoped working at 11am (GMT+1), with no action from my part, with this error:

[Google_Service_Exception] 调用 GET 时出错https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=xxxxxxxxxx&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:(403) 访问未配置.未为您的项目启用 API,或者在您的设备上配置了每个 IP 或每个引用者的限制APIkey 和请求不匹配这些限制.请用Google Developers Console 以更新您的配置.

[Google_Service_Exception] Error calling GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=xxxxxxxxxx&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: (403) Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your APIkey and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.

注意:我使用了不到 10 个请求,在每天允许的 5000 万个中,我有一个静态公共 IP 地址,这部分代码没有被改动.

请问我可以寻找什么来解决这个问题?我真的不知道从现在开始要去哪里......谢谢.

What can i look for in order to fix that, please? I really don't know where to head for from now... Thank you.

推荐答案

Oooook...

在生成任何密钥之前执行 API 激活所需的所有操作!

Do all you have to with the API activations before you generate any keys!

取消激活或重新激活 API(如Youtube Data")会悄悄破坏您的密钥有效性.至少对于服务器来说.

Unactivating or reactivating API (like "Youtube Data") silently destroys your key validity. At least for the server one.

所以解决方案是,当你遇到和我一样的错误时:

  • 销毁您的服务器密钥(彻底删除它,不要只重新生成)
  • 停用然后重新激活您需要的所有 API
  • 创建一个新的服务器密钥
  • 感谢 Google 提供如此清晰的错误消息(可选)

这篇关于Youtube API v3 显示“未配置访问"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆