Package com.auth0.net

Class TokenRequest

All Implemented Interfaces:
AuthRequest, Request<TokenHolder>

public class TokenRequest extends CustomRequest<TokenHolder> implements AuthRequest
  • Constructor Details

    • TokenRequest

      public TokenRequest(okhttp3.OkHttpClient client, String url)
  • Method Details

    • setRealm

      public TokenRequest setRealm(String realm)
      Description copied from interface: AuthRequest
      Setter for the realm value to request
      Specified by:
      setRealm in interface AuthRequest
      Parameters:
      realm - the realm to request
      Returns:
      this request instance.
    • setAudience

      public TokenRequest setAudience(String audience)
      Description copied from interface: AuthRequest
      Setter for the audience value to request
      Specified by:
      setAudience in interface AuthRequest
      Parameters:
      audience - the audience to request
      Returns:
      this request instance.
    • setScope

      public TokenRequest setScope(String scope)
      Description copied from interface: AuthRequest
      Setter for the scope value to request
      Specified by:
      setScope in interface AuthRequest
      Parameters:
      scope - the scope to request
      Returns:
      this request instance.
    • createRequest

      protected okhttp3.Request createRequest() throws Auth0Exception
      Specified by:
      createRequest in class BaseRequest<T>
      Throws:
      Auth0Exception
    • parseResponse

      protected TokenHolder parseResponse(okhttp3.Response response) throws Auth0Exception
      Specified by:
      parseResponse in class BaseRequest<T>
      Throws:
      Auth0Exception
    • getContentType

      protected String getContentType()
      Getter for the content-type header value to use on this request
      Returns:
      the content-type
    • createResponseException

      protected Auth0Exception createResponseException(okhttp3.Response response)
      Responsible for parsing an unsuccessful request (status code other than 200) and generating a developer-friendly exception with the error details.
      Parameters:
      response - the unsuccessful response, as received. If its body is accessed, the buffer must be closed.
      Returns:
      the exception with the error details.