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)
, andFacebookClient.obtainExtendedAccessToken(String, String, String)
for details.- Author:
- Mark Allen
-
-
Constructor Summary
Constructors Constructor Description AccessToken()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object that)
static AccessToken
fromQueryString(String queryString)
Given a query string of the formaccess_token=XXX
oraccess_token=XXX&expires=YYY
, return anAccessToken
instance.String
getAccessToken()
The access token's value.FacebookClient
getClient()
Date
getExpires()
The date on which the access token expires.String
getTokenType()
The token type of this access token provided by FacebookString
getUserId()
int
hashCode()
void
setClient(FacebookClient client)
void
setUserId(String userId)
String
toString()
-
-
-
Constructor Detail
-
AccessToken
public AccessToken()
-
-
Method Detail
-
setClient
public void setClient(FacebookClient client)
-
getClient
public FacebookClient getClient()
-
fromQueryString
public static AccessToken fromQueryString(String queryString)
Given a query string of the formaccess_token=XXX
oraccess_token=XXX&expires=YYY
, return anAccessToken
instance.The
queryString
is required to contain anaccess_token
parameter with a non-null
value. Theexpires
value is optional and should be the number of seconds since the epoch. If theexpires
value cannot be parsed, the returnedAccessToken
will have anull
expires
value.- Parameters:
queryString
- The Facebook query string out of which to parse anAccessToken
instance.- Returns:
- An
AccessToken
instance which corresponds to the givenqueryString
. - Throws:
IllegalArgumentException
- If noaccess_token
parameter is present in the query string.- Since:
- 1.6.10
-
getAccessToken
public String 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
-
-