Google Auth Library Client - Class AccessToken (1.47.1)

Reference documentation and code samples for the Google Auth Library Client class AccessToken.

Wrapper around Google Access Tokens which provides convenience functions.

Namespace

Google \ Auth

Methods

__construct

Parameters
Name
Description
httpHandler
callable|null

[optional] An HTTP Handler to deliver PSR-7 requests.

cache
Psr\Cache\CacheItemPoolInterface |null

[optional] A PSR-6 compatible cache implementation.

verify

Verifies an id token and returns the authenticated apiLoginTicket.

Throws an exception if the id token is not valid. The audience parameter can be used to control which id tokens are accepted. By default, the id token must have been issued to this OAuth2 client.

Parameters
Name
Description
token
string

The JSON Web Token to be verified.

options
array

Configuration options.

↳ audience
string

The indended recipient of the token.

↳ issuer
string

The intended issuer of the token.

↳ cacheKey
string

The cache key of the cached certs. Defaults to the sha1 of $certsLocation if provided, otherwise is set to "federated_signon_certs_v3".

↳ certsLocation
string

The location (remote or local) from which to retrieve certificates, if not cached. This value should only be provided in limited circumstances in which you are sure of the behavior.

↳ throwException
bool

Whether the function should throw an exception if the verification fails. This is useful for determining the reason verification failed.

Returns
Type
Description
array|false
the token payload, if successful, or false if not.

revoke

Revoke an OAuth2 access token or refresh token. This method will revoke the current access token, if a token isn't provided.

Parameters
Name
Description
token
string|array

The token (access token or a refresh token) that should be revoked.

options
array

[optional] Configuration options.

Returns
Type
Description
bool
Returns True if the revocation was successful, otherwise False.

Constants

FEDERATED_SIGNON_CERT_URL

  Value: 'https://www.googleapis.com/oauth2/v3/certs' 
 

IAP_CERT_URL

  Value: 'https://www.gstatic.com/iap/verify/public_key-jwk' 
 

IAP_ISSUER

  Value: 'https://cloud.google.com/iap' 
 

OAUTH2_ISSUER

  Value: 'accounts.google.com' 
 

OAUTH2_ISSUER_HTTPS

  Value: 'https://accounts.google.com' 
 

OAUTH2_REVOKE_URI

  Value: 'https://oauth2.googleapis.com/revoke' 
 
Design a Mobile Site
View Site in Mobile | Classic
Share by: