I need to write a web app for a marketing company which needs to connect to their customers websites to access Google analytics data and store it in their database. I follow the example provided by Google at: https://developers.google.com/analytics/solutions/articles/hello-analytics-api I created the following Client id at Google API console
Client ID: 915242733409.apps.googleusercontent.com
Email address: [email protected]
Client secret: xxx
Redirect URIs: http://thefridgedoors.net/google-analytics/google-api-php-client/examples/analytics/simple.php
JavaScript origins: https://www.thefridgedoors.net
My app's authentication looks as follows:
/* 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'));
However I get the following error: There wan a general error :
Error calling GET https://www.googleapis.com/analytics/v3/management/accounts?key=AIzaSyALRCwV32b8fAtcvFuaDVwNUxrYrtg51tI: (403) Access Not Configured
Any hint on what might be wrong?