I am using Google analytic api to retrieve data from my analytic account (in java). My code works fine on my computer (windows 7) also I have tested same code on Linux computer. In both case it works fine but When i put the same code in production server, It gives below error.
Query Created: {dimensions=ga:customVarValue1,ga:keyword,ga:source,ga:medium,ga:campaign,ga:adGroup,ga:date, end-date=2013-01-21, ids=ga:xxxxxxxx, max-results=10000, metrics=ga:visitors, sort=ga:date, start-date=2013-01-20, start-index=1}
com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
{
"error" : "invalid_grant"
}
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:103)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:303)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:323)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:320)
at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:505)
at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:266)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:399)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
I checked code again but I don't think there is something wrong with code. Do you think there is something strategically wrong which can cause this problem? because error is relevant to authentication, so It should work anywhere if it works successfully on a computer, right?
EDIT: Same program works fine in windows7, ubuntu 11.04, but this error happens only in ubuntu 12.10