class AccessTokenAuthenticator implements OAuthAuthenticator

Methods

__construct(string $accessToken, string|null $refreshToken = null, DateTimeImmutable|null $expiresAt = null, array|null $scopes = null)

Create an access token authenticator.

void
set(PendingRequest $pendingRequest)

Apply the authentication to the request.

bool
hasExpired()

Check if the access token has expired.

bool
hasNotExpired()

Check if the access token has not expired.

string
getAccessToken()

Get the access token.

string|null
getRefreshToken()

Get the refresh token.

getExpiresAt()

Get the expiry.

array|null
getScopes()

Get the reported scopes.

bool
isRefreshable()

Determine if the authenticator is refreshable.

bool
isNotRefreshable()

Determine if the authenticator is not refreshable.

Details

at line 20
__construct(string $accessToken, string|null $refreshToken = null, DateTimeImmutable|null $expiresAt = null, array|null $scopes = null)

Create an access token authenticator.

Parameters

string $accessToken
string|null $refreshToken
DateTimeImmutable|null $expiresAt
array|null $scopes

at line 33
void set(PendingRequest $pendingRequest)

Apply the authentication to the request.

Parameters

PendingRequest $pendingRequest

Return Value

void

at line 41
bool hasExpired()

Check if the access token has expired.

Return Value

bool

at line 49
bool hasNotExpired()

Check if the access token has not expired.

Return Value

bool

at line 57
string getAccessToken()

Get the access token.

Return Value

string

at line 65
string|null getRefreshToken()

Get the refresh token.

Return Value

string|null

at line 73
DateTimeImmutable|null getExpiresAt()

Get the expiry.

Return Value

DateTimeImmutable|null

at line 83
array|null getScopes()

Get the reported scopes.

Return Value

array|null

at line 91
bool isRefreshable()

Determine if the authenticator is refreshable.

Return Value

bool

at line 99
bool isNotRefreshable()

Determine if the authenticator is not refreshable.

Return Value

bool