NAME

OIDC::Client::AccessToken - Access Token class

DESCRIPTION

Class representing an access token

ATTRIBUTES

token

The string of the access token. Required

refresh_token

The refresh token which can be used to obtain new access tokens using the same authorization grant

token_type

The type of the access token

expires_at

The expiration time of the access token (number of seconds since 1970-01-01T00:00:00Z)

scopes

The scopes (arrayref) of the access token

claims

Hashref of claims coming from the access token. Optional, as an access token is not always decoded, depending on the nature of the application.

METHODS

has_scope( $expected_scope )

my $has_scope = $access_token->has_scope($expected_scope);

Returns whether a scope is present in the scopes of the access token.

has_expired( $leeway )

my $has_expired = $access_token->has_expired();

Returns whether the access token has expired.

Returns undef if the expires_at attribute is not defined.

The list parameters are:

leeway

Number of seconds of leeway for the token to be considered expired before it actually is.

to_hashref()

my $access_token_href = $access_token->to_hashref();

Returns a hashref of the access token data.