Google Glass 开发错误:(403) 未配置访问权限.请使用 Google Developers Console 为您的项目激活 API
我使用的是 PHP 版本的 Google Glass Developer Kit.按照示例代码说明设置所有内容.API/凭据都很好,设置了帐户计费,已将镜像 API 添加到项目中,但在我许可该应用程序后,出现以下错误:
I am using the PHP version of the Google Glass Developer Kit. Setup everything per the sample code instructions. API/credentials are all fine, account billing is setup, have added the Mirror API to the project, but after I permission the application, I get the following Error:
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.
我添加了 Mirror API 并启用了 Billing 并进行了设置,所以不知道为什么我会收到错误消息.通过 Glass Explorer 测试应用效果很好.
I have added the Mirror API and have Billing active and setup so have no idea why i am getting the error message. Testing the app via the Glass Explorer works just fine.
推荐答案
众所周知,当您同时提供 OAuth2 凭据和 API 密钥时,Google API 会出现错误行为.此外,由于您必须使用 OAuth2 来访问镜像 API,因此无论如何都不需要 key=xxxxx
.
Google APIs have been known to misbehave when you provide both OAuth2 credentials and an API Key. Also since you have to use OAuth2 to access the Mirror API, the key=xxxxx
isn't necessary anyway.
如果您使用的是适用于 PHP 的 Google API 客户端库,则只需从代码中删除以下行:
If you are using the Google APIs Client Library for PHP you can simply remove the following line from your code:
$client->setDeveloperKey($key);
不完全确定这是否会导致您的问题,但我在其他 Google API 中遇到过类似问题.
Not entirely sure if this causes your issue, but I have come across similar issues in other Google APIs.
相关文章