【发布时间】:2015-04-19 21:22:49
【问题描述】:
我正在关注this 页面上的教程,但是当我运行应用程序并尝试进行搜索时,我不断收到 403 Forbidden 错误。
我在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."
}
【问题讨论】:
-
我已经通过创建浏览器键而不是安卓键解决了这个问题。浏览器键需要没有条目,以便它会说“所有引用都允许”
-
您应该将其写为答案并接受它,以便将来的人们知道该怎么做。
-
好吧,Rohan,我做到了。谢谢。
-
尝试使用服务器密钥而不是浏览器、android 和 IOS。
标签: android json youtube youtube-api