Class TokenResponseException

  • All Implemented Interfaces:
    java.io.Serializable

    public class TokenResponseException
    extends com.google.api.client.http.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.

    Since:
    1.7
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.api.client.http.HttpResponseException

        com.google.api.client.http.HttpResponseException.Builder
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static TokenResponseException from​(com.google.api.client.json.JsonFactory jsonFactory, com.google.api.client.http.HttpResponse response)
      Returns a new instance of TokenResponseException.
      TokenErrorResponse getDetails()
      Returns the token error response details or null if unable to parse.
      • Methods inherited from class com.google.api.client.http.HttpResponseException

        computeMessageBuffer, getContent, getHeaders, getStatusCode, getStatusMessage, isSuccessStatusCode
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • details

        private final transient TokenErrorResponse details
        Token error response details or null if unable to parse.
    • Constructor Detail

      • TokenResponseException

        TokenResponseException​(com.google.api.client.http.HttpResponseException.Builder builder,
                               TokenErrorResponse details)
        Parameters:
        builder - builder
        details - token error response details or null if unable to parse
    • Method Detail

      • getDetails

        public final TokenErrorResponse getDetails()
        Returns the token error response details or null if unable to parse.
      • from

        public static TokenResponseException from​(com.google.api.client.json.JsonFactory jsonFactory,
                                                  com.google.api.client.http.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:
        jsonFactory - JSON factory
        response - HTTP response
        Returns:
        new instance of TokenErrorResponse