Mehdisouid / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

TokenInfo validation throws IllegalArgumentException for invalid tokens #595

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client (e.g. 1.5.0-beta)?
1.10.3-beta

Java environment (e.g. Java 6, Android 2.3, App Engine)?
1.6.0_30

Describe the problem.
TokenInfo validation throws java.lang.IllegalArgumentException while trying to 
validate an access token after application permissions has been revoked.

The issue can be reproduces using OAuth2Sample example.

Please find below the stack trace:
java.lang.IllegalArgumentException: error for field null
    at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:621)
    at com.google.api.client.json.JsonParser.parse(JsonParser.java:296)
    at com.google.api.client.json.JsonParser.parse(JsonParser.java:273)
    at com.google.api.client.json.JsonParser.parseAndClose(JsonParser.java:148)
    at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:132)
    at com.google.api.client.googleapis.json.GoogleJsonResponseException.execute(GoogleJsonResponseException.java:203)
    at com.google.api.client.googleapis.services.GoogleClient.executeUnparsed(GoogleClient.java:237)
    at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:207)
    at com.google.api.services.oauth2.Oauth2$Tokeninfo.execute(Oauth2.java:484)
    at com.google.api.services.samples.oauth2.cmdline.OAuth2Sample.tokenInfo(OAuth2Sample.java:89)
    at com.google.api.services.samples.oauth2.cmdline.OAuth2Sample.main(OAuth2Sample.java:73)
Caused by: java.lang.IllegalArgumentException: expected primitive class, but 
got: class com.google.api.client.googleapis.json.GoogleJsonError
    at com.google.api.client.util.Data.parsePrimitiveValue(Data.java:451)
    at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:619)
    ... 10 more

How would you expect it to be fixed?
I would expect to get a GoogleJsonResponseException with 400 status code, and a 
JSON body  {"error":"invalid_token"} as per specification 
https://developers.google.com/accounts/docs/OAuth2Login#validatingtoken

Original issue reported on code.google.com by AZagorne...@gmail.com on 22 Aug 2012 at 1:46

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 2 Oct 2012 at 1:58

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 7 Dec 2012 at 10:00

GoogleCodeExporter commented 9 years ago
I can no longer reproduce it.  It appears they fixed it on the server side 
because I now see this error response:

{
 "error_description": "Invalid Value",
}

Original comment by yan...@google.com on 22 Jan 2013 at 5:55