AppAuth-Android icon indicating copy to clipboard operation
AppAuth-Android copied to clipboard

Accessing the original JSON string from a deserialization exception

Open bbqsrc opened this issue 7 years ago • 3 comments

At the moment I am getting an AuthorizationException due to apparently malformed JSON but this is rather difficult to debug if I cannot get access to the response itself. Is there currently a mechanism to do this?

bbqsrc avatar Apr 29 '18 19:04 bbqsrc

Currently no, we don't retain JSON for debugging inspection. It's something I would consider adding, though we are wary of exposing security-sensitive data like codes and tokens in a manner that might inadvertently be logged.

In the meantime, it should be straighforward to set a breakpoint where token responses are parsed to take a look at the string parameter.

iainmcgin avatar Apr 29 '18 21:04 iainmcgin

It would be useful to add an API for a hook for handling it, even if the exception doesn't carry it.

I've hit a number of cases where the JSON object partially does not comply with what AppAuth is expecting, and being able to handle this myself instead of having fork the library or throw it away is extremely important.

bbqsrc avatar Apr 29 '18 21:04 bbqsrc

Interested in this as well.

We are trying to use AppAuth to interact with a custom Keycloak Authenticator, which adds new fields to the error response. Without, either direct access to the JSON or having the extra fields added to the Exception somehow (maybe an additionalFields attribute, in a similar fashion to AuthorizationResponse#additionalParameters), we are screwed :sweat_smile:

pcuriel avatar Feb 07 '24 15:02 pcuriel