问题描述
我正在使用Java运行Analytics-cmdline-sample应用程序.我正在使用Maven 2.2.1,已经在Google Api控制台中创建了一个client_Id和client_secret.我已经确保我可以在自己的Google Analytics(分析)帐户中访问拥有Google Analytics(分析)的网站.
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.
我已经撤消了client_secret并尝试了.
I have revoked the client_secret and tried that as well.
我当前遇到以下错误:
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.
推荐答案
就我而言,"client_id"是问题的根源.我添加了一个简短的" client_id(xxxxxxxxxxxx.apps.googleusercontent.com).当我创建新的"Web应用程序的客户端ID"时,新的client_id较长(xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com),错误消失了.
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.
这篇关于Google Analytics(分析)中的Invalid_grant的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!