Youtube API权限403禁止错误

kj *_*ino 21 youtube android json youtube-api

我正在关注页面上的教程,但是当我运行应用程序并尝试进行搜索时,我一直收到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."
}
Run Code Online (Sandbox Code Playgroud)

kj *_*ino 36

我通过创建浏览器密钥而不是Android密钥解决了这个问题.浏览器密钥不需要输入,因此它会说"所有提到的允许"