Invalid_grant in Google Analytics

我的梦境 提交于 2020-01-04 01:56:08

问题


I am running the Analytics-cmdline-sample application with Java. I am using Maven 2.2.1, I have created a client_Id and client_secret in the Google Api Console. I have ensured that in my Google Analytics account that I have access to the websites I have Google Analytics on.

I have revoked the client_secret and tried that as well.

I am currently getting the following error:

com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
{
  "error" : "invalid_grant"
}

I have looked through for many solutions to these problems, but I haven't found any solution as of yet that would resolve this error.


回答1:


In my case, the "client_id" was the root of the problem. I add a "short" client_id (xxxxxxxxxxxx.apps.googleusercontent.com). When I created a new "Client ID for web applications" the new client_id was longer (xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com) and the error disappeared.



来源:https://stackoverflow.com/questions/14622344/invalid-grant-in-google-analytics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!