AccessToken
extends SettingsContainerAbstract
in package
FinalYes
Access token implementation for any OAuth version.
Tags
Table of Contents
Constants
- EXPIRY_MAX = 86400 * 365
- Defines a maximum expiry period (1 year)
- EXPIRY_UNKNOWN = -0xdead
- Denotes an unknown end of lifetime, such a token should be considered as expired.
- NEVER_EXPIRES = -0xcafe
- Denotes a token which never expires
Properties
- $accessToken : string|null
- $accessTokenSecret : string|null
- $expires : int
- $extraParams : array<string, mixed>
- $provider : string|null
- $refreshToken : string|null
- $scopes : array<string|int, string>
- $accessToken : string|null
- (magic) The oauth access token
- $accessTokenSecret : string|null
- (magic) The access token secret (OAuth1)
- $expires : int
- (magic) The token expiration time
- $extraParams : array<string, mixed>
- (magic) Additional token parameters supplied by the provider
- $provider : string|null
- (magic) The provider that issued the token
- $refreshToken : string|null
- (magic) An optional refresh token (OAuth2)
- $scopes : array<string|int, string>
- (magic) The scopes that are attached to this token
Methods
- isExpired() : bool
- Checks whether this token is expired
- set_expires() : void
- Sets the expiration for this token, clamps the expiry to EXPIRY_MAX
Constants
EXPIRY_MAX
Defines a maximum expiry period (1 year)
public
int
EXPIRY_MAX
= 86400 * 365
EXPIRY_UNKNOWN
Denotes an unknown end of lifetime, such a token should be considered as expired.
public
int
EXPIRY_UNKNOWN
= -0xdead
NEVER_EXPIRES
Denotes a token which never expires
public
int
NEVER_EXPIRES
= -0xcafe
Properties
$accessToken
public
string|null
$accessToken
$accessTokenSecret
public
string|null
$accessTokenSecret
$expires
public
int
$expires
$extraParams
public
array<string, mixed>
$extraParams
$provider
public
string|null
$provider
$refreshToken
public
string|null
$refreshToken
$scopes
public
array<string|int, string>
$scopes
$accessToken
(magic) The oauth access token
protected
string|null
$accessToken
= null
$accessTokenSecret
(magic) The access token secret (OAuth1)
protected
string|null
$accessTokenSecret
= null
$expires
(magic) The token expiration time
protected
int
$expires
= self::EXPIRY_UNKNOWN
The getter accepts: DateTime|DateInterval|int|null
$extraParams
(magic) Additional token parameters supplied by the provider
protected
array<string, mixed>
$extraParams
= []
$provider
(magic) The provider that issued the token
protected
string|null
$provider
= null
$refreshToken
(magic) An optional refresh token (OAuth2)
protected
string|null
$refreshToken
= null
$scopes
(magic) The scopes that are attached to this token
protected
array<string|int, string>
$scopes
= []
Methods
isExpired()
Checks whether this token is expired
public
isExpired() : bool
Return values
boolset_expires()
Sets the expiration for this token, clamps the expiry to EXPIRY_MAX
protected
set_expires([DateTime|DateInterval|int|null $expires = null ]) : void
-
0
sets the expiry toNEVER_EXPIRES
-
null
, negative integer values or timestamps fromDateTime
andDateInterval
that are in the past set the expiry toEXPIRY_UNKNOWN
Parameters
- $expires : DateTime|DateInterval|int|null = null