Android SDK Version
All Implemented Interfaces:
android.os.Parcelable


public final class AccessToken
 implements Parcelable
This class represents an immutable access token for using Facebook APIs. It also includes associated metadata such as expiration date and permissions.
For more information on access tokens, see Access Tokens.
Nested Class Summary
Modifier and TypeClassDescription
public interfaceAccessToken.AccessTokenRefreshCallback
public interfaceAccessToken.AccessTokenCreationCallback
A callback for creating an access token from a NativeLinkingIntent
public classAccessToken.Companion
Field Summary
Modifier and TypeFieldDescription
private final Dateexpires
private final Set<String>permissions
private final Set<String>declinedPermissions
private final Set<String>expiredPermissions
private final Stringtoken
private final AccessTokenSourcesource
private final DatelastRefresh
private final StringapplicationId
private final StringuserId
private final DatedataAccessExpirationTime
private final StringgraphDomain
private final BooleanisExpired
private final BooleanisDataAccessExpired
private final BooleanisInstagramToken
Constructor Summary
ConstructorDescription
AccessToken(String accessToken, String applicationId, String userId, Collection<String> permissions, Collection<String> declinedPermissions, Collection<String> expiredPermissions, AccessTokenSource accessTokenSource, Date expirationTime, Date lastRefreshTime, Date dataAccessExpirationTime, String graphDomain)Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK).
AccessToken(String accessToken, String applicationId, String userId, Collection<String> permissions, Collection<String> declinedPermissions, Collection<String> expiredPermissions, AccessTokenSource accessTokenSource, Date expirationTime, Date lastRefreshTime, Date dataAccessExpirationTime)Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK).
Method Summary
Modifier and TypeMethodDescription
final DategetExpires() Gets the date at which the access token expires.
final Set<String>getPermissions() Gets the list of permissions associated with this access token.
final Set<String>getDeclinedPermissions() Gets the list of permissions declined by the user with this access token.
final Set<String>getExpiredPermissions() Gets the list of permissions that were expired with this access token.
final StringgetToken() Gets the string representing the access token.
final AccessTokenSourcegetSource() Gets the AccessTokenSource indicating how this access token was obtained.
final DategetLastRefresh() Gets the date at which the token was last refreshed.
final StringgetApplicationId() Gets the ID of the Facebook Application associated with this access token.
final StringgetUserId() Returns the user id for this access token.
final DategetDataAccessExpirationTime() Gets the date at which user data access expires.
final StringgetGraphDomain() Returns the graph domain for this access token.
final BooleangetIsExpired()
final BooleangetIsDataAccessExpired()
final BooleangetIsInstagramToken()
StringtoString()
Booleanequals(Object other)
IntegerhashCode()
IntegerdescribeContents()
UnitwriteToParcel(Parcel dest, Integer flags)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

AccessToken

AccessToken(String accessToken, String applicationId, String userId, Collection<String> permissions, Collection<String> declinedPermissions, Collection<String> expiredPermissions, AccessTokenSource accessTokenSource, Date expirationTime, Date lastRefreshTime, Date dataAccessExpirationTime, String graphDomain)
Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK).
Parameters:
accessToken - the access token string obtained from Facebook
applicationId - the ID of the Facebook Application associated with this access token
userId - the id of the user
permissions - the permissions that were requested when the token was obtained (or when it was last reauthorized); may be null if permission set is unknown
declinedPermissions - the permissions that were declined when the token was obtained; may be null if permission set is unknown
expiredPermissions - the permissions that were expired when the token was obtained; may be null if permission set is unknown
accessTokenSource - an enum indicating how the token was originally obtained (in most cases, this will be either AccessTokenSource.FACEBOOK_APPLICATION or AccessTokenSource.WEB_VIEW); if null, FACEBOOK_APPLICATION is assumed.
expirationTime - the expiration date associated with the token; if null, an infinite expiration time is assumed (but will become correct when the token is refreshed)
lastRefreshTime - the last time the token was refreshed (or when it was first obtained); if null, the current time is used.
dataAccessExpirationTime - The time when user data access expires
graphDomain - The Graph API domain that this token is valid for.

AccessToken

AccessToken(String accessToken, String applicationId, String userId, Collection<String> permissions, Collection<String> declinedPermissions, Collection<String> expiredPermissions, AccessTokenSource accessTokenSource, Date expirationTime, Date lastRefreshTime, Date dataAccessExpirationTime)
Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK).
Parameters:
accessToken - the access token string obtained from Facebook
applicationId - the ID of the Facebook Application associated with this access token
userId - the id of the user
permissions - the permissions that were requested when the token was obtained (or when it was last reauthorized); may be null if permission set is unknown
declinedPermissions - the permissions that were declined when the token was obtained; may be null if permission set is unknown
expiredPermissions - the permissions that were expired when the token was obtained; may be null if permission set is unknown
accessTokenSource - an enum indicating how the token was originally obtained (in most cases, this will be either AccessTokenSource.FACEBOOK_APPLICATION or AccessTokenSource.WEB_VIEW); if null, FACEBOOK_APPLICATION is assumed.
expirationTime - the expiration date associated with the token; if null, an infinite expiration time is assumed (but will become correct when the token is refreshed)
lastRefreshTime - the last time the token was refreshed (or when it was first obtained); if null, the current time is used.
dataAccessExpirationTime - The time when user data access expires
Method Detail

getExpires

 final DategetExpires()
Gets the date at which the access token expires.

getPermissions

 final Set<String> getPermissions()
Gets the list of permissions associated with this access token. Note that the most up-to-date list of permissions is maintained by Facebook, so this list may be outdated if permissions have been added or removed since the time the AccessToken object was created. For more information on permissions, see https://developers.facebook.com/docs/reference/login/#permissions.

getDeclinedPermissions

 final Set<String> getDeclinedPermissions()
Gets the list of permissions declined by the user with this access token. It represents the entire set of permissions that have been requested and declined. Note that the most up-to-date list of permissions is maintained by Facebook, so this list may be outdated if permissions have been granted or declined since the last time an AccessToken object was created.

getExpiredPermissions

 final Set<String> getExpiredPermissions()
Gets the list of permissions that were expired with this access token.

getToken

 final StringgetToken()
Gets the string representing the access token.

getSource

 final AccessTokenSourcegetSource()
Gets the AccessTokenSource indicating how this access token was obtained.

getLastRefresh

 final DategetLastRefresh()
Gets the date at which the token was last refreshed. Since tokens expire, the Facebook SDK will attempt to renew them periodically.

getApplicationId

 final StringgetApplicationId()
Gets the ID of the Facebook Application associated with this access token.

getUserId

 final StringgetUserId()
Returns the user id for this access token.

getDataAccessExpirationTime

 final DategetDataAccessExpirationTime()
Gets the date at which user data access expires.

getGraphDomain

 final StringgetGraphDomain()
Returns the graph domain for this access token.

getIsExpired

 final BooleangetIsExpired()

getIsDataAccessExpired

 final BooleangetIsDataAccessExpired()

getIsInstagramToken

 final BooleangetIsInstagramToken()

toString

StringtoString()

equals

Booleanequals(Object other)

hashCode

IntegerhashCode()

describeContents

IntegerdescribeContents()

writeToParcel

UnitwriteToParcel(Parcel dest, Integer flags)