【发布时间】:2013-07-19 02:31:50
【问题描述】:
我需要为一家营销公司编写一个网络应用程序,该公司需要连接到他们的客户网站以访问 Google 分析数据并将其存储在他们的数据库中。 我按照 Google 在以下位置提供的示例进行操作: https://developers.google.com/analytics/solutions/articles/hello-analytics-api 我在 Google API 控制台创建了以下客户端 ID
Client ID: 915242733409.apps.googleusercontent.com
Email address: 915242733409@developer.gserviceaccount.com
Client secret: xxx
Redirect URIs: http://thefridgedoors.net/google-analytics/google-api-php-client/examples/analytics/simple.php
JavaScript origins: https://www.thefridgedoors.net
我的应用的身份验证如下:
/* Start a session to persist credentials */
session_start();
/* Create and configure a new client object */
$client = new Google_Client();
$client->setApplicationName("Google+ PHP Starter Application");
// Visit https://code.google.com/apis/console to generate your
// oauth2_client_id, oauth2_client_secret, and to register your oauth2_redirect_uri.
$client->setClientId('915242733409.apps.googleusercontent.com');
$client->setClientSecret('…');
$client->setRedirectUri('http://thefridgedoors.net/google-analytics/example1.php');
$client->setDeveloperKey('…');
$client->setScopes(array('https://www.googleapis.com/auth/analytics.readonly'));
但是我收到以下错误: 出现一般错误:
Error calling GET https://www.googleapis.com/analytics/v3/management/accounts?key=AIzaSyALRCwV32b8fAtcvFuaDVwNUxrYrtg51tI: (403) Access Not Configured
有什么可能出错的提示吗?
【问题讨论】:
-
您应该重置您在此处发布的 API 密钥。我已将它们从您的帖子中删除,但它们可能在我到达这里之前已被盗,并且具有足够知识的 SO 用户仍然可以查看它们。
标签: google-analytics google-api-php-client