Class TokenResponse

java.lang.Object
com.nimbusds.oauth2.sdk.TokenResponse
All Implemented Interfaces:
Message, Response
Direct Known Subclasses:
AccessTokenResponse, TokenErrorResponse

public abstract class TokenResponse extends Object implements Response
Token endpoint response. This is the base abstract class for access token (success) and token error responses.

Related specifications:

  • OAuth 2.0 (RFC 6749)
  • Constructor Details

  • Method Details

    • toSuccessResponse

      Casts this response to an access token response.
      Returns:
      The access token response.
    • toErrorResponse

      Casts this response to a token error response.
      Returns:
      The token error response.
    • parse

      public static TokenResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException
      Parses a token response from the specified JSON object.
      Parameters:
      jsonObject - The JSON object to parse. Must not be null.
      Returns:
      The access token or token error response.
      Throws:
      ParseException - If the JSON object couldn't be parsed to a token response.
    • parse

      public static TokenResponse parse(HTTPResponse httpResponse) throws ParseException
      Parses a token response from the specified HTTP response.
      Parameters:
      httpResponse - The HTTP response. Must not be null.
      Returns:
      The access token or token error response.
      Throws:
      ParseException - If the HTTP response couldn't be parsed to a token response.