1.55.4 (latest) 1.55.3 1.52.0 1.50.1 1.49.0 1.48.1 1.47.1 1.46.0 1.45.2

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

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

Wrapper around Google Access Tokens which provides convenience functions.

**IMPORTANT** : Default endpoints on this class target the `googleapis.com` universe domain.
[AccessToken::revoke()](https://docs.cloud.google.com/php/docs/reference/auth/latest/AccessToken.md.txt#_Google_Auth_AccessToken__revoke__) is not supported outside of the default universe domain.

## 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` option should be set to the expected recipient (for
example, your OAuth2 client ID or target endpoint URL) to verify the
token's `aud` claim. When omitted, audience validation is skipped.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `token` | `string` The JSON Web Token to be verified. |
| `options` | `array` Configuration options. |
| `↳ audience` | `string` The intended recipient of the token. When omitted, the `aud` claim is not verified. |
| `↳ 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.

**IMPORTANT** : This method is not supported outside of the default universe domain
(`googleapis.com`) and always sends requests to `https://oauth2.googleapis.com/revoke`.

| **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

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

### IAP_CERT_URL

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

### IAP_ISSUER

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

### OAUTH2_ISSUER

```php
Value: 'accounts.google.com'
```

### OAUTH2_ISSUER_HTTPS

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

### OAUTH2_REVOKE_URI

```php
Value: 'https://oauth2.googleapis.com/revoke'
```