-
- 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
Nested Classes Modifier and Type Class Description public interfaceAccessToken.AccessTokenRefreshCallbackpublic interfaceAccessToken.AccessTokenCreationCallbackA callback for creating an access token from a NativeLinkingIntent
public classAccessToken.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Dateexpiresprivate final Set<String>permissionsprivate final Set<String>declinedPermissionsprivate final Set<String>expiredPermissionsprivate final Stringtokenprivate final AccessTokenSourcesourceprivate final DatelastRefreshprivate final StringapplicationIdprivate final StringuserIdprivate final DatedataAccessExpirationTimeprivate final StringgraphDomainprivate final BooleanisExpiredprivate final BooleanisDataAccessExpiredprivate final BooleanisInstagramToken
-
Constructor Summary
Constructors Constructor Description 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 Type Method Description 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)-
-
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 FacebookapplicationId- the ID of the Facebook Application associated with this access tokenuserId- the id of the userpermissions- the permissions that were requested when the token was obtained (or when it was last reauthorized); may be null if permission set is unknowndeclinedPermissions- the permissions that were declined when the token was obtained; may be null if permission set is unknownexpiredPermissions- the permissions that were expired when the token was obtained; may be null if permission set is unknownaccessTokenSource- 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 expiresgraphDomain- 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 FacebookapplicationId- the ID of the Facebook Application associated with this access tokenuserId- the id of the userpermissions- the permissions that were requested when the token was obtained (or when it was last reauthorized); may be null if permission set is unknowndeclinedPermissions- the permissions that were declined when the token was obtained; may be null if permission set is unknownexpiredPermissions- the permissions that were expired when the token was obtained; may be null if permission set is unknownaccessTokenSource- 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 Date getExpires()
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.
-
getSource
final AccessTokenSource getSource()
Gets the AccessTokenSource indicating how this access token was obtained.
-
getLastRefresh
final Date getLastRefresh()
Gets the date at which the token was last refreshed. Since tokens expire, the Facebook SDK will attempt to renew them periodically.
-
getApplicationId
final String getApplicationId()
Gets the ID of the Facebook Application associated with this access token.
-
getDataAccessExpirationTime
final Date getDataAccessExpirationTime()
Gets the date at which user data access expires.
-
getGraphDomain
final String getGraphDomain()
Returns the graph domain for this access token.
-
getIsExpired
final Boolean getIsExpired()
-
getIsDataAccessExpired
final Boolean getIsDataAccessExpired()
-
getIsInstagramToken
final Boolean getIsInstagramToken()
-
describeContents
Integer describeContents()
-
writeToParcel
Unit writeToParcel(Parcel dest, Integer flags)
-
-
-
-