Synchronizing server time and atomic time?

Status
Not open for further replies.

luis-diaz65

New Member
Messages
5
Reaction score
0
Points
1
I am trying to connect to Google Analytics API with PHP, and so I downloaded the Google APis Client Library for PHP, I used Google Developers Console to create a service account and declared the Client ID, key etc. But when I try to run service-account.php I get this error:

Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /home/texterx1/public_html/google-api-php-client-master/src/Google/Auth/OAuth2.php:327 Stack trace: #0 /home/texterx1/public_html/google-api-php-client-master/src/Google/Auth/OAuth2.php(289): Google_Auth_OAuth2->refreshTokenRequest(Array) #1 /home/texterx1/public_html/google-api-php-client-master/examples/service-account.php(75): Google_Auth_OAuth2->refreshTokenWithAssertion(Object(Google_Auth_AssertionCredentials)) #2 {main} thrown in /home/texterx1/public_html/google-api-php-client-master/src/Google/Auth/OAuth2.php on line 327

I tried to solve this problem on StackOverflow, but there I got the answer that the problem has to do with server time on my server probably being some time delayed compared to atomic time. Could this be true? (link to StackOverflow thread: http://stackoverflow.com/questions/...-when-trying-to-connect-to-oauth-2-0-with-php).

Any help is appreciated, I have struggled with this quite some time now and digged long and hard around the web.
Thanks!
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,818
Reaction score
163
Points
63
I've ensured that the server time is synced with a time server. If your issue is not resolved, then the issue is most likely not with the server, but rather with your script.
 
Status
Not open for further replies.
Top