1

我正在嘗試實施Analytics Reporting API V4。 使用這個例子linkAnalytics Reporting API V4 API問題

Fatal error: Uncaught exception 'Google_Service_Exception' with message ' in

Google_Service_Exception: { "error": "invalid_scope", "error_description": "Empty or missing scope not allowed." }

請幫我解決這個錯誤。

謝謝

回答

3

有斑點。我認爲該教程中有一個錯誤。

$client->setAuthConfig($KEY_FILE_LOCATION); 
$client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']); 
$analytics = new Google_Service_AnalyticsReporting($client); 

嘗試在代碼中添加上面的中間行。你需要設置一個範圍才能工作。

讓我知道它是否有效,我會通過電子郵件向開發團隊發送並更正教程。

+0

Thanks.Its working。 – JPT

+0

真棒我會錯誤地抱怨團隊。 – DaImTo

+0

發送的電子郵件如果您想跟蹤它,我還將其記錄爲問題https://code.google.com/p/analytics-issues/issues/detail?id=993 – DaImTo