Exception TokenResponseException (1.34.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
NameDescription
jsonFactorycom.google.api.client.json.JsonFactory

JSON factory

responsecom.google.api.client.http.HttpResponse

HTTP response

Returns
TypeDescription
TokenResponseException

new instance of TokenErrorResponse

Methods

getDetails()

public final TokenErrorResponse getDetails()

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

Returns
TypeDescription
TokenErrorResponse