# Google API Core Client - Class CredentialsWrapper (1.43.0)

1.43.0 (latest) 1.42.5 1.40.0 1.38.2 1.36.1 1.35.1 Reference documentation and code samples for the Google API Core Client class CredentialsWrapper.

The CredentialsWrapper object provides a wrapper around a FetchAuthTokenInterface.

## Namespace

Google \\ ApiCore

## Methods

### __construct

CredentialsWrapper constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `credentialsFetcher` | `https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html` A credentials loader used to fetch access tokens. |
| `authHttpHandler` | `callable` A handler used to deliver PSR-7 requests specifically for authentication. Should match a signature of `function (RequestInterface $request, array $options) : ResponseInterface`. |
| `universeDomain` | `string` |

### getQuotaProject

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string|null` | The quota project associated with the credentials. |

### getProjectId

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `httpHandler` | `?callable` |

### getBearerString

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | Bearer string containing access token. |

### getAuthorizationHeaderCallback

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `audience` | `string` optional audience for self-signed JWTs. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `callable` | Callable function that returns an authorization header. |

### checkUniverseDomain

Verify that the expected universe domain matches the universe domain from the credentials.

### static::build

Factory method to create a CredentialsWrapper from an array of options.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `args` | `array` An array of optional arguments. |
| `↳ keyFile` | `string|array` Credentials to be used. Accepts either a path to a credentials file, or a decoded credentials file as a PHP array. If this is not specified, application default credentials will be used. |
| `↳ scopes` | `string[]` A string array of scopes to use when acquiring credentials. |
| `↳ authHttpHandler` | `callable` A handler used to deliver PSR-7 requests specifically for authentication. Should match a signature of `function (RequestInterface $request, array $options) : ResponseInterface`. |
| `↳ enableCaching` | `bool` Enable caching of access tokens. Defaults to true. |
| `↳ authCache` | `Psr\Cache\CacheItemPoolInterface` A cache for storing access tokens. Defaults to a simple in memory implementation. |
| `↳ authCacheOptions` | `array` Cache configuration options. |
| `↳ quotaProject` | `string` Specifies a user project to bill for access charges associated with the request. |
| `↳ defaultScopes` | `string[]` A string array of default scopes to use when acquiring credentials. |
| `↳ useJwtAccessWithScope` | `bool` Ensures service account credentials use JWT Access (also known as self-signed JWTs), even when user-defined scopes are supplied. |
| `universeDomain` | `string` The expected universe of the credentials. Defaults to "googleapis.com" |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper` |   |