Comment #3 on issue 879 by
mike.sch...@promevo.com: Invalid_request from
credential.refreshToken()
http://code.google.com/p/google-api-java-client/issues/detail?id=879
Here is an example of a failure and a successful call below. I commented
out some of the codes that are sent back and forth for security reasons.
ERRORED
CONFIG: -------------- REQUEST --------------
POST
https://accounts.google.com/o/oauth2/token
Accept-Encoding: gzip
User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip)
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 568
May 19, 2014 3:45:14 PM com.google.api.client.http.HttpRequest execute
CONFIG: curl -v --compressed -X POST -H 'Accept-Encoding: gzip'
-H 'User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip)' -H 'Content-Type:
application/x-www-form-urlencoded; charset=UTF-8' -d '@-'
-- '
https://accounts.google.com/o/oauth2/token' << $$$
May 19, 2014 3:45:14 PM
com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: Total: 568 bytes
May 19, 2014 3:45:14 PM
com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG:
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
<< commented out for security
May 19, 2014 3:45:14 PM
com.google.apphosting.utils.jetty.AppEngineAuthentication$AppEngineAuthenticator
authenticate
FINE: Got /_ah/channel/dev, returning NOBODY to imply authentication is in
progress.
May 19, 2014 3:45:14 PM com.google.api.client.http.HttpResponse <init>
CONFIG: -------------- RESPONSE --------------
403 OK
content-type: application/json; charset=utf-8
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: Fri, 01 Jan 1990 00:00:00 GMT
date: Mon, 19 May 2014 15:45:00 GMT
content-disposition: attachment; filename="json.txt";
filename*=UTF-8''json.txt
content-encoding: gzip
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
server: GSE
alternate-protocol: 443:quic
transfer-encoding: chunked
May 19, 2014 3:45:14 PM
com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: Total: 33 bytes
May 19, 2014 3:45:14 PM
com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: {
"error" : "invalid_request"
}
GOOD ONE
CONFIG: -------------- REQUEST --------------
POST
https://accounts.google.com/o/oauth2/token
Accept-Encoding: gzip
User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip)
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 568
May 19, 2014 3:59:05 PM com.google.api.client.http.HttpRequest execute
CONFIG: curl -v --compressed -X POST -H 'Accept-Encoding: gzip'
-H 'User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip)' -H 'Content-Type:
application/x-www-form-urlencoded; charset=UTF-8' -d '@-'
-- '
https://accounts.google.com/o/oauth2/token' << $$$
May 19, 2014 3:59:05 PM
com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: Total: 568 bytes
May 19, 2014 3:59:05 PM
com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG:
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
<< commented out for security
May 19, 2014 3:59:05 PM
com.google.apphosting.utils.jetty.AppEngineAuthentication$AppEngineAuthenticator
authenticate
FINE: Got /_ah/channel/dev, returning NOBODY to imply authentication is in
progress.
May 19, 2014 3:59:05 PM com.google.api.client.http.HttpResponse <init>
CONFIG: -------------- RESPONSE --------------
200 OK
content-type: application/json; charset=utf-8
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: Fri, 01 Jan 1990 00:00:00 GMT
date: Mon, 19 May 2014 15:58:51 GMT
content-disposition: attachment; filename="json.txt";
filename*=UTF-8''json.txt
content-encoding: gzip
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
server: GSE
alternate-protocol: 443:quic
transfer-encoding: chunked
May 19, 2014 3:59:05 PM
com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: Total: 120 bytes
May 19, 2014 3:59:05 PM
com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: {
"access_token" : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", <--
replaced for security.
"token_type" : "Bearer",
"expires_in" : 3600