Documentation

AccessToken extends SettingsContainerAbstract
in package

FinalYes

Access token implementation for any OAuth version.

Tags
link
https://datatracker.ietf.org/doc/html/rfc5849#section-2.3
link
https://datatracker.ietf.org/doc/html/rfc6749#section-1.4

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

$accessTokenSecret

public string|null $accessTokenSecret

$extraParams

public array<string, mixed> $extraParams

$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
bool

set_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 to NEVER_EXPIRES
  • null, negative integer values or timestamps from DateTime and DateInterval that are in the past set the expiry to EXPIRY_UNKNOWN
Parameters
$expires : DateTime|DateInterval|int|null = null

        
On this page

Search results