Reputation: 452
I'm trying to get the Google Analytics API to work and have started with the basic tutorial from Google in PHP.
For some reason, I keep getting the following error message:
Error calling GET https://www.googleapis.com/analytics/v3/management/accounts?key=my_developer_key_from_the_console: (403) Access Not Configured
I couldn't find any solution to this, mainly because I believe I've set everything up correctly:
What am I missing?
Upvotes: 4
Views: 2557
Reputation:
I had this problem too. Interestingly, if you don't use the client library and simply use a cURL request instead with your access_token appended, it works and JSON is returned.
At least by using cURL you can be sure if it really is your configuration, or its something that the client library is doing.
$url = 'https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles';
// json decode as array
$analytics_auth = json_decode($_SESSION['access_code'], true);
$ch = curl_init($url . '?access_token=' . $analytics_auth['access_token']);
curl_exec($ch);
curl_close($ch);
Upvotes: 0
Reputation: 11
I got the same error and i fixed it by enable the Google plus api from google console.
Upvotes: 1
Reputation: 117291
You dont pass the key from apis console to
https://www.googleapis.com/analytics/v3/management/accounts?
you should be passing the access token that you got from oauth.
https://www.googleapis.com/analytics/v3/management/accounts?oauth_token={yourtoken}
Upvotes: 2