Youtube API 权限 403 禁止错误

Youtube API permission 403 Forbidden error

我正在按照 this 页面上的教程进行操作,但是当我 运行 应用程序并尝试进行搜索时,我总是收到 403 禁止访问错误。

我在 https://console.developers.google.com/ 页面上启用了 Youtube Data API v3,并创建了一个 Android API 密钥。

有什么建议吗?谢谢。

Could not search: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "usageLimits",
"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.",
"reason" : "ipRefererBlocked",
"extendedHelp" : "https://console.developers.google.com"
} ],
"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."
}

我已经通过创建浏览器键而不是 android 键解决了这个问题。浏览器密钥不能有任何条目,这样它就会显示 "all refered allowed"

我已经通过创建服务器密钥而不是 iOS 密钥解决了问题

我遇到了同样的问题,在浪费了很多时间之后,我的托管服务发现 API 请求是由与我的网站关联的 IP 地址不同的 IP 地址生成的。

将此用于 iOS 应用程序并收到相同的错误,因此我删除了包标识符并且它起作用了