Invalid_grant in Google Analytics
I am running Analytics-cmdline-sample application with Java. I am using Maven 2.2.1, I created client_Id and client_secret in google api console. I have made sure that in my Google Analytics account, I have access to the sites where I have Google Analytics.
I canceled the client_secret and tried it.
I am currently getting the following error:
com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
{
"error" : "invalid_grant"
}
I have looked through many solutions to these problems, but have not yet found a solution that resolves this error.
source to share
In my case, "client_id" was the root of the problem. I add a "short" client_id (xxxxxxxxxxxx.apps.googleusercontent.com). When I created a new "Web Application Client ID" the new client_id is greater (xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com) and the error went away.
source to share