Google Glass开发错误:(403)访问未配置.请使用Google Developers Console激活项目的API

Met*_*orp 2 php google-api google-glass google-mirror-api

我正在使用PHP版本的Google Glass Developer Kit.根据示例代码说明设置所有内容.API /凭证都很好,帐户开票已设置,已将Mirror API添加到项目中,但在我允许应用程序后,我收到以下错误:

An error ocurred: Error calling POST 
https://www.googleapis.com/mirror/v1/timeline?key=xxxxxx 
(403) Access Not Configured. 
Please use Google Developers Console to activate the API for your project.
Run Code Online (Sandbox Code Playgroud)

我已经添加了Mirror API并且有Billing活动和设置,所以不知道为什么我收到错误消息.通过Glass Explorer测试应用程序就可以了.

Sca*_*ami 9

众所周知,当您提供OAuth2凭据和API密钥时,Google API会出现行为异常.此外,由于您必须使用OAuth2来访问镜像API,因此key=xxxxx无论如何都不需要.

如果您使用的是Google API客户端库,则只需从代码中删除以下行:

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

不完全确定这是否会导致您的问题,但我在其他Google API中遇到过类似的问题.

  • 我有同样的错误,但这没有解决它.在google-api-php-client/src中评论//公共函数setDeveloperKey($ key){$ this-> key = $ key;}后,我仍然有403. (2认同)
  • stanzheng - 您是否1)确保将Mirror API添加到您的API列表中; 2)确保您的帐户中已添加了结算信息(不确定是否有必要但是已经阅读了这些可能有关的地方用它) (2认同)