Reputation: 77
I am trying to implement Analytics Reporting API V4. Using this example link
Fatal error: Uncaught exception 'Google_Service_Exception' with message ' in
Google_Service_Exception: { "error": "invalid_scope", "error_description": "Empty or missing scope not allowed." }
Please help me to solve this error.
Thanks
Upvotes: 1
Views: 756
Reputation: 117271
Well spotted. I think there is an error in that tutorial.
$client->setAuthConfig($KEY_FILE_LOCATION);
$client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']);
$analytics = new Google_Service_AnalyticsReporting($client);
Try and add the middle line above in your code. You need to set a scope for it to work.
Let me know if it works and I will email the dev team and get the tutorial corrected.
Upvotes: 4