I am stuck with this error. I just successfully received an authorization code and I am trying to exchange it for an access token, but I get the error message "invalid_request".
I am using Apache HttpComponents library (current version) for the request, and there the UrlEncodedFormEntity as I am making a post request.
Here is my request information:
Request body: scope=&client_secret=[my_secret]&grant_type=authorization_code&redirect_uri=http%3A%2F%2Fmydomain.org%3A8080%2F[some parameters etc...]%3FplatformID%3D3&client_id=23[...]-rg[...].apps.googleusercontent.com&code=[my_encoded_authorizationCode]
Request-URL: https://accounts.google.com/o/oauth2/token
Request-Method: POST
Request headers --
User-Agent = MAC: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.25 (KHTML, like Gecko) Version/6.0 Safari/536.25 // this is a fake user agent I have set by the header manipulation
Content-Type = application/x-www-form-urlencoded
Response headers --
Cache-Control = no-cache, no-store, max-age=0, must-revalidate
Pragma = no-cache
Expires = Fri, 01 Jan 1990 00:00:00 GMT
Date = Sun, 02 Dec 2012 11:44:34 GMT
Content-Type = application/json
X-Content-Type-Options = nosniff
X-Frame-Options = SAMEORIGIN
X-XSS-Protection = 1; mode=block
Server = GSE
Transfer-Encoding = chunked
Response:
{
"error" : "invalid_request"
}
Any help? I am stuck for days, researching and implementing other OAuth2-protocols, but Google's one does not work...
Best greetings and thanks, Martin Bories