Class AuthorizationToken

java.lang.Object
net.amcintosh.freshbooks.models.AuthorizationToken

public class AuthorizationToken extends Object
Authorization data including the OAuth bearer token, expiry, and refresh token.
  • Constructor Details

    • AuthorizationToken

      public AuthorizationToken()
      Create empty authorization data.
    • AuthorizationToken

      public AuthorizationToken(String accessToken)
      Create authorization data from a pre-existing, valid, bearer token.
      Parameters:
      accessToken -
    • AuthorizationToken

      public AuthorizationToken(String accessToken, String refreshToken)
      Create authorization data from pre-existing, valid, bearer and refresh tokens.
      Parameters:
      accessToken -
      refreshToken -
  • Method Details

    • getAccessToken

      public String getAccessToken()
      Get the authorized bearer token from the OAuth2 token response.
      Returns:
    • setAccessToken

      public void setAccessToken(String accessToken)
      Set the bearer token for use in the client.
      Parameters:
      accessToken -
    • getRefreshToken

      public String getRefreshToken()
      Get the authorized refresh token from the OAuth2 token response.
      Returns:
    • setRefreshToken

      public void setRefreshToken(String refreshToken)
      Set the refresh token for use in the client. This will allow the client to call the token refresh and get a new bearer token if expired.
      Parameters:
      refreshToken -
    • getCreatedAt

      public ZonedDateTime getCreatedAt()
      Time the bearer token was created.
      Returns:
      UTC ZonedDateTime
    • getExpiresAt

      public ZonedDateTime getExpiresAt()
      Time the bearer token expires at.
      Returns:
      UTC ZonedDateTime
    • getExpiresIn

      public long getExpiresIn()
      Number of seconds since creation that the token will expire at.

      Please note getExpiresAt() which calculates the expiry time from this and createdAt.
      Returns:
      Seconds
    • getScopes

      public List<String> getScopes()
      Get the scopes that the token is authorized for.
      Returns:
      List of scope strings.