AzureAD / microsoft-authentication-library-common-for-android

Common code used by both the Active Directory Authentication Library (ADAL) and the Microsoft Authentication Library (MSAL)
MIT License
41 stars 35 forks source link

Return status code in errorResponse when server response is not in expected Json format. #2321

Closed iamgusain closed 7 months ago

iamgusain commented 8 months ago

What

Return status code in errorResponse when server response is not in expected Json format.

Why

If the response is not in expected json format, today we don't catch JsonParsing exception and it bubbles up to the caller. So the caller get the JsonException instead of the actual server error response.

How

Catching the JSON parsing exception and returning the TokenErrorResponse with error and description set to the statuscode

Testing

Tested with an error scenario, where the response was not in json format.