Skip to content

FR: relax JSON parsing of TokenResponse (and JsonWebToken) #62

@wonderfly

Description

@wonderfly

From michel.j...@e-office.com on November 28, 2012 00:30:25

Version of google-oauth-java-client (e.g. 1.5.0-beta)?
1.12.0

Java environment (e.g. Java 6, Android 2.3, App Engine)?
AppEngine 1.7.3

Describe the problem.
When consuming Microsoft Office365 OAuth services, the accessToken that is retrieved through:

AuthorizationCodeTokenRequest . execute() as per the sample, I get the error:
number field formatted as a JSON string must use the @JsonString annotation How would you expect it to be fixed? In the JSONParser.java (from com.google.api.client.json)
I commented out the Preconditions check, and now I have an accesstoken. And also the expires in has a value...

--------- start here -------

  case VALUE_STRING:

//        Preconditions.checkArgument(valueClass == null || !Number.class.isAssignableFrom(valueClass)
//            || fieldContext != null && fieldContext.getAnnotation(JsonString.class) != null,
//            "number field formatted as a JSON string must use the @JsonString annotation%s",
//            contextString);
        // TODO(yanivi): "special" values like Double.POSITIVE_INFINITY?
        try {
          return Data.parsePrimitiveValue(valueType, getText());
        } catch (IllegalArgumentException e) {
          throw new IllegalArgumentException(contextString, e);
        }

Original issue: http://code.google.com/p/google-oauth-java-client/issues/detail?id=62

Metadata

Metadata

Assignees

Labels

type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions