出现错误 403:未配置访问.请使用 Google Developers Console 为您的项目激活 API

我正在尝试使用 Youtube API 从特定频道中提取所有视频.我在 Google Developers Console 中设置了项目并获得了 API 浏览器密钥.我启用了 YouTube Data API v3,为了安全起见,我启用了 YouTube Analytics API.

I am trying to use the Youtube API to pull in all the videos from a particular channel. I set up the project in Google Developers Console and got an API browser key. I enabled YouTube Data API v3 and for safe measure, I enabled YouTube Analytics API.

我不知道我收到了这个错误.谁能帮帮我.

I do not know what I am getting this error. Can anyone help me.

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
   }
  ],
  "code": 403,
  "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
 }
}

我正在使用的代码.它还没有做任何事情,只是尝试获取数据.

Code i'm using. It doesn't do anything yet, just try to fetch the data.

jQuery.getJSON('https://www.googleapis.com/youtube/v3/channels?part=UncleBens&id=UncleBens&key=AIzaSyDXD80S1mFHH2HSZFxLemkae-_Cl_nY5Xk', function(data){
    console.log(data);
    for(var i=0; i<data.data.items.length; i++) {
       console.log(data.data.items[i].title); // title
       console.log(data.data.items[i].description); // description
    }
});

推荐答案

尝试在 Google Developers Console 如果还不是这样的话.

Try setting the "Referers" to "Any referer allowed" for your project (just leave the field empty) in the Google Developers Console if it is not already like that.

为此,请转到您的 Google Developers Console 并打开 API&Auth/Credentials 并单击Edit allowed referers"清空输入字段.

To do this, go to your Google Developers Console and open API & Auth / Credentials and click "Edit allowed referers" empty the input field.

相关文章