Exception TokenResponseException (1.36.0)

public class TokenResponseException extends HttpResponseException

Exception thrown when receiving an error response from the token server as specified in Error Response

To get the structured details, use #getDetails().

Sample usage can be found for AuthorizationCodeTokenRequest.

Static Methods

from(JsonFactory jsonFactory, HttpResponse response)

public static TokenResponseException from(JsonFactory jsonFactory, HttpResponse response)

Returns a new instance of TokenResponseException.

If there is a JSON error response, it is parsed using TokenErrorResponse, which can be inspected using #getDetails(). Otherwise, the full response content is read and included in the exception message.

Parameters
Name Description
jsonFactory com.google.api.client.json.JsonFactory

JSON factory

response com.google.api.client.http.HttpResponse

HTTP response

Returns
Type Description
TokenResponseException

new instance of TokenErrorResponse

Methods

getDetails()

public final TokenErrorResponse getDetails()

Returns the token error response details or null if unable to parse.

Returns
Type Description
TokenErrorResponse