1

我正在使用 Google 分析 api 从我的分析帐户中检索数据(在 java 中)。我的代码在我的计算机(Windows 7)上运行良好,我也在 Linux 计算机上测试了相同的代码。在这两种情况下它都可以正常工作,但是当我将相同的代码放在生产服务器中时,它会给出以下错误。

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)

我再次检查了代码,但我认为代码没有问题。你认为有什么战略上的错误会导致这个问题吗?因为错误与身份验证有关,所以如果它在计算机上成功运行,它应该可以在任何地方运行,对吧?

编辑:相同的程序在 windows7、ubuntu 11.04 中运行良好,但此错误仅在 ubuntu 12.10 中发生

4

0 回答 0