Cheetah
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Facebook\Authentication\AccessTokenMetadata Class Reference

Public Member Functions

 __construct (array $metadata)
 
 getField ($field, $default=null)
 
 getProperty ($field, $default=null)
 
 getChildProperty ($parentField, $field, $default=null)
 
 getErrorProperty ($field, $default=null)
 
 getMetadataProperty ($field, $default=null)
 
 getAppId ()
 
 getApplication ()
 
 isError ()
 
 getErrorCode ()
 
 getErrorMessage ()
 
 getErrorSubcode ()
 
 getExpiresAt ()
 
 getIsValid ()
 
 getIssuedAt ()
 
 getMetadata ()
 
 getSso ()
 
 getAuthType ()
 
 getAuthNonce ()
 
 getProfileId ()
 
 getScopes ()
 
 getUserId ()
 
 validateAppId ($appId)
 
 validateUserId ($userId)
 
 validateExpiration ()
 

Protected Attributes

 $metadata = []
 

Static Protected Attributes

static $dateProperties = ['expires_at', 'issued_at']
 

Detailed Description

Definition at line 36 of file AccessTokenMetadata.php.

Constructor & Destructor Documentation

◆ __construct()

Facebook\Authentication\AccessTokenMetadata::__construct ( array  $metadata)
Parameters
array$metadata
Exceptions
FacebookSDKException

Definition at line 57 of file AccessTokenMetadata.php.

Member Function Documentation

◆ getAppId()

Facebook\Authentication\AccessTokenMetadata::getAppId ( )

The ID of the application this access token is for.

Returns
string|null

Definition at line 154 of file AccessTokenMetadata.php.

◆ getApplication()

Facebook\Authentication\AccessTokenMetadata::getApplication ( )

Name of the application this access token is for.

Returns
string|null

Definition at line 164 of file AccessTokenMetadata.php.

◆ getAuthNonce()

Facebook\Authentication\AccessTokenMetadata::getAuthNonce ( )

The 'auth_nonce' child property from the 'metadata' parent property.

Returns
string|null

Definition at line 281 of file AccessTokenMetadata.php.

◆ getAuthType()

Facebook\Authentication\AccessTokenMetadata::getAuthType ( )

The 'auth_type' child property from the 'metadata' parent property.

Returns
string|null

Definition at line 271 of file AccessTokenMetadata.php.

◆ getChildProperty()

Facebook\Authentication\AccessTokenMetadata::getChildProperty (   $parentField,
  $field,
  $default = null 
)

Returns a value from a child property in the metadata.

Parameters
string$parentFieldThe parent property.
string$fieldThe property to retrieve.
mixed$defaultThe default to return if the property doesn't exist.
Returns
mixed

Definition at line 110 of file AccessTokenMetadata.php.

◆ getErrorCode()

Facebook\Authentication\AccessTokenMetadata::getErrorCode ( )

The error code for the error.

Returns
int|null

Definition at line 185 of file AccessTokenMetadata.php.

◆ getErrorMessage()

Facebook\Authentication\AccessTokenMetadata::getErrorMessage ( )

The error message for the error.

Returns
string|null

Definition at line 195 of file AccessTokenMetadata.php.

◆ getErrorProperty()

Facebook\Authentication\AccessTokenMetadata::getErrorProperty (   $field,
  $default = null 
)

Returns a value from the error metadata.

Parameters
string$fieldThe property to retrieve.
mixed$defaultThe default to return if the property doesn't exist.
Returns
mixed

Definition at line 131 of file AccessTokenMetadata.php.

◆ getErrorSubcode()

Facebook\Authentication\AccessTokenMetadata::getErrorSubcode ( )

The error subcode for the error.

Returns
int|null

Definition at line 205 of file AccessTokenMetadata.php.

◆ getExpiresAt()

Facebook\Authentication\AccessTokenMetadata::getExpiresAt ( )

DateTime when this access token expires.

Returns
\DateTime|null

Definition at line 215 of file AccessTokenMetadata.php.

◆ getField()

Facebook\Authentication\AccessTokenMetadata::getField (   $field,
  $default = null 
)

Returns a value from the metadata.

Parameters
string$fieldThe property to retrieve.
mixed$defaultThe default to return if the property doesn't exist.
Returns
mixed

Definition at line 76 of file AccessTokenMetadata.php.

◆ getIssuedAt()

Facebook\Authentication\AccessTokenMetadata::getIssuedAt ( )

DateTime when this access token was issued.

Note that the issued_at field is not returned for short-lived access tokens.

See also
https://developers.facebook.com/docs/facebook-login/access-tokens#debug
Returns
\DateTime|null

Definition at line 240 of file AccessTokenMetadata.php.

◆ getIsValid()

Facebook\Authentication\AccessTokenMetadata::getIsValid ( )

Whether the access token is still valid or not.

Returns
boolean|null

Definition at line 225 of file AccessTokenMetadata.php.

◆ getMetadata()

Facebook\Authentication\AccessTokenMetadata::getMetadata ( )

General metadata associated with the access token. Can contain data like 'sso', 'auth_type', 'auth_nonce'.

Returns
array|null

Definition at line 251 of file AccessTokenMetadata.php.

◆ getMetadataProperty()

Facebook\Authentication\AccessTokenMetadata::getMetadataProperty (   $field,
  $default = null 
)

Returns a value from the "metadata" metadata. Brain explodes

Parameters
string$fieldThe property to retrieve.
mixed$defaultThe default to return if the property doesn't exist.
Returns
mixed

Definition at line 144 of file AccessTokenMetadata.php.

◆ getProfileId()

Facebook\Authentication\AccessTokenMetadata::getProfileId ( )

For impersonated access tokens, the ID of the page this token contains.

Returns
string|null

Definition at line 292 of file AccessTokenMetadata.php.

◆ getProperty()

Facebook\Authentication\AccessTokenMetadata::getProperty (   $field,
  $default = null 
)

Returns a value from the metadata.

Parameters
string$fieldThe property to retrieve.
mixed$defaultThe default to return if the property doesn't exist.
Returns
mixed

Definition at line 96 of file AccessTokenMetadata.php.

◆ getScopes()

Facebook\Authentication\AccessTokenMetadata::getScopes ( )

List of permissions that the user has granted for the app in this access token.

Returns
array

Definition at line 303 of file AccessTokenMetadata.php.

◆ getSso()

Facebook\Authentication\AccessTokenMetadata::getSso ( )

The 'sso' child property from the 'metadata' parent property.

Returns
string|null

Definition at line 261 of file AccessTokenMetadata.php.

◆ getUserId()

Facebook\Authentication\AccessTokenMetadata::getUserId ( )

The ID of the user this access token is for.

Returns
string|null

Definition at line 313 of file AccessTokenMetadata.php.

◆ isError()

Facebook\Authentication\AccessTokenMetadata::isError ( )

Any error that a request to the graph api would return due to the access token.

Returns
bool|null

Definition at line 175 of file AccessTokenMetadata.php.

◆ validateAppId()

Facebook\Authentication\AccessTokenMetadata::validateAppId (   $appId)

Ensures the app ID from the access token metadata is what we expect.

Parameters
string$appId
Exceptions
FacebookSDKException

Definition at line 326 of file AccessTokenMetadata.php.

◆ validateExpiration()

Facebook\Authentication\AccessTokenMetadata::validateExpiration ( )

Ensures the access token has not expired yet.

Exceptions
FacebookSDKException

Definition at line 353 of file AccessTokenMetadata.php.

◆ validateUserId()

Facebook\Authentication\AccessTokenMetadata::validateUserId (   $userId)

Ensures the user ID from the access token metadata is what we expect.

Parameters
string$userId
Exceptions
FacebookSDKException

Definition at line 341 of file AccessTokenMetadata.php.

Member Data Documentation

◆ $dateProperties

Facebook\Authentication\AccessTokenMetadata::$dateProperties = ['expires_at', 'issued_at']
staticprotected

Definition at line 50 of file AccessTokenMetadata.php.

◆ $metadata

Facebook\Authentication\AccessTokenMetadata::$metadata = []
protected

Definition at line 43 of file AccessTokenMetadata.php.


The documentation for this class was generated from the following file: