We use this walk through, to set up our tool. Hello Analytics Reporting API V4; PHP quickstart for service accounts
Here is the example from the walkthrough https://advertisebg.com/report1610/GA/HelloAnalytics.php and the code is Exactly the same as in the example
Fatal error: Uncaught Google_Service_Exception: { "error": { "code": 401, "message": "Request had invalid authentication credentials.", "errors": [ { "message": "Request had invalid authentication credentials.", "domain": "global", "reason": "unauthorized" } ], "status": "UNAUTHENTICATED" } } in /home/advbg/public_html/report1610/GA/src/Google/Http/REST.php:118 Stack trace: #0 /home/advbg/public_html/report1610/GA/src/Google/Http/REST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\Psr7\Response), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #1 /home/advbg/public_html/report1610/GA/src/Google/Task/Runner.php(181): Google_Http_REST::doExecute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #2 /home/advbg/public_html/report1610/GA/src/Google/Http/REST.php(58): Google_Task_Runner->run() #3 /home/advbg/public_html/report1610/GA/src/Google/Client.php(782): Google_Http_REST::execute(Object(GuzzleHttp\Client), in /home/advbg/public_html/report1610/GA/src/Google/Http/REST.php on line 118
After several hours without any problems we receives the following error “Request had invalid authentication credentials”
Several times we restart with new project, recreate the Credentials, install new example and every time - the same result, after having working well for couple of hours, we see the error above.
Any ideas?