Package com.restfb

Class AccessToken

java.lang.Object
com.restfb.AccessToken

public class AccessToken extends Object
Represents an access token/expiration date pair.

Facebook returns these types when performing access token-related operations - see FacebookClient.convertSessionKeysToAccessTokens(String, String, String...), FacebookClient.obtainAppAccessToken(String, String), and FacebookClient.obtainExtendedAccessToken(String, String, String) for details.

Author:
Mark Allen
  • Constructor Details

  • Method Details

    • setClient

      public void setClient(FacebookClient client)
    • getClient

    • fromQueryString

      public static AccessToken fromQueryString(String queryString)
      Given a query string of the form access_token=XXX or access_token=XXX&expires=YYY, return an AccessToken instance.

      The queryString is required to contain an access_token parameter with a non-null value. The expires value is optional and should be the number of seconds since the epoch. If the expires value cannot be parsed, the returned AccessToken will have a null expires value.

      Parameters:
      queryString - The Facebook query string out of which to parse an AccessToken instance.
      Returns:
      An AccessToken instance which corresponds to the given queryString.
      Throws:
      IllegalArgumentException - If no access_token parameter is present in the query string.
      Since:
      1.6.10
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object that)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAccessToken

      The access token's value.
      Returns:
      The access token's value.
    • getExpires

      public Date getExpires()
      The date on which the access token expires.
      Returns:
      The date on which the access token expires.
    • getTokenType

      public String getTokenType()
      The token type of this access token provided by Facebook
      Returns:
      the access token type
    • getUserId

      public String getUserId()
    • setUserId

      public void setUserId(String userId)