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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Auth Library Client - Class AccessToken (1.47.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.47.1 (latest)](/php/docs/reference/auth/latest/AccessToken)\n- [1.47.0](/php/docs/reference/auth/1.47.0/AccessToken)\n- [1.46.0](/php/docs/reference/auth/1.46.0/AccessToken)\n- [1.45.2](/php/docs/reference/auth/1.45.2/AccessToken) \n| **Beta**\n|\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1)\n| of the Terms of Service. Pre-GA libraries might have limited support,\n| and changes to pre-GA libraries might not be compatible with other pre-GA versions.\n| For more information, see the\n[launch stage descriptions](/products#product-launch-stages). \nReference documentation and code samples for the Google Auth Library Client class AccessToken.\n\nWrapper around Google Access Tokens which provides convenience functions.\n\nNamespace\n---------\n\nGoogle \\\\ Auth\n\nMethods\n-------\n\n### __construct\n\n### verify\n\nVerifies an id token and returns the authenticated apiLoginTicket.\n\nThrows an exception if the id token is not valid.\nThe audience parameter can be used to control which id tokens are\naccepted. By default, the id token must have been issued to this OAuth2 client.\n\n### revoke\n\nRevoke an OAuth2 access token or refresh token. This method will revoke the current access\ntoken, if a token isn't provided.\n\nConstants\n---------\n\n### FEDERATED_SIGNON_CERT_URL\n\n Value: 'https://www.googleapis.com/oauth2/v3/certs'\n\n### IAP_CERT_URL\n\n Value: 'https://www.gstatic.com/iap/verify/public_key-jwk'\n\n### IAP_ISSUER\n\n Value: 'https://cloud.google.com/iap'\n\n### OAUTH2_ISSUER\n\n Value: 'accounts.google.com'\n\n### OAUTH2_ISSUER_HTTPS\n\n Value: 'https://accounts.google.com'\n\n### OAUTH2_REVOKE_URI\n\n Value: 'https://oauth2.googleapis.com/revoke'"]]