消息403错误:访问未配置.请使用Google Developers Console激活项目的API

mas*_*zen 12 php google-calendar-api google-api drupal-7 oauth-2.0

无法克服这种情况:在Google开发人员控制台中创建了一个项目,他们创建了"Web应用程序的客户端ID"和"服务器应用程序的密钥".

在控制台中请求已成功完成,但是当我从服务器发送时,我收到以下错误:

403: {
 "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."
 }
}
Run Code Online (Sandbox Code Playgroud)

检查构造查询的参数..请求继续:

"https://www.googleapis.com/calendar/v3/freeBusy?key=my_key"
pass parameters: "{"items":[{"id":"calendar_id@group.calendar.google.com"}],"timeMax":"2014-04-09T00:00:00+01:00","timeMin":"2014-01-09T00:00:00+01:00","timeZone":"Europe\/Berlin"}"
Run Code Online (Sandbox Code Playgroud)

我在哪里可以看到错误是什么?

是否在此帮助结算中(此时它已关闭"结算未启用")?

==========================更新:问题得到了解决(如萨满教):我刚刚在google api中创建了一个新项目,接下来选项卡"API&auth-> Credentials"我添加到项目"Web应用程序的客户端ID",当您创建时立即创建"重定向URI"时,会自动生成"可以与任何主机一起使用的浏览器应用程序密钥".完成这些步骤后,我指向一个网站创建的设置和请求.

发送使用drupal和模块的请求:gauth和gcal(使用http://code.google.com/p/google-api-php-client/).

Met*_*orp 25

我得到了完全相同的错误(使用Google Glass Mirror API除外).添加结算信息并将http/https添加到我的重定向网址也无济于事.

显然,当您提供OAuth2凭据和API密钥时,Google API会出现行为错误!解决方案(如果您使用的是用于PHP的Google API客户端库)只需从代码中删除以下内容:

$client->setDeveloperKey($key);
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助.

  • 这可能不会被标记为答案 - 但它解决了我的问题!我正在使用版本1.0.3-beta和[Hello World tutorial here](https://developers.google.com/analytics/solutions/articles/hello-analytics-api)....虽然那个教程目前已经过时了...... (3认同)