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 Reference documentation and code samples for the Google Auth Library Client class CredentialsLoader.

CredentialsLoader contains the behaviour used to locate and find default
credentials files on the file system.

## Namespace

Google \\ Auth

## Implements

[GetUniverseDomainInterface](https://docs.cloud.google.com/php/docs/reference/auth/latest/GetUniverseDomainInterface.md.txt) [FetchAuthTokenInterface](https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.md.txt) [UpdateMetadataInterface](https://docs.cloud.google.com/php/docs/reference/auth/latest/UpdateMetadataInterface.md.txt)

## Methods

### getUniverseDomain

Get the universe domain from the credential. Defaults to "googleapis.com"
for all credential types which do not support universe domain.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### static::fromEnv

Load a JSON key from the path specified in the environment.

Load a JSON key from the path specified in the environment
variable GOOGLE_APPLICATION_CREDENTIALS. Return null if
GOOGLE_APPLICATION_CREDENTIALS is not specified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array|null` | JSON key \| null |

### static::fromWellKnownFile

Load a JSON key from a well known path.

The well known path is OS dependent:

- windows: %APPDATA%/gcloud/application_default_credentials.json
- others: $HOME/.config/gcloud/application_default_credentials.json

If the file does not exist, this returns null.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array|null` | JSON key \| null |

### static::makeCredentials

See also:

- <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials>

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `scope` | `string|string[]` |
| `jsonKey` | `array` |
| `defaultScope` | `string|string[]` |
| `enableRegionalAccessBoundary` | `bool` Lookup and include the regional access boundary header. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Credentials\ServiceAccountCredentials|Credentials\UserRefreshCredentials|Credentials\ImpersonatedServiceAccountCredentials|Credentials\ExternalAccountCredentials|Credentials\ExternalAccountAuthorizedUserCredentials` |   |

### static::makeHttpClient

Create an authorized HTTP Client from an instance of FetchAuthTokenInterface.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fetcher` | `FetchAuthTokenInterface` is used to fetch the auth token |
| `httpClientOptions` | `array` (optional) Array of request options to apply. |
| `httpHandler` | `callable|null` (optional) http client to fetch the token. |
| `tokenCallback` | `callable|null` (optional) function to be called when a new token is fetched. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Client` |   |

### static::makeInsecureCredentials

Create a new instance of InsecureCredentials.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Credentials\InsecureCredentials` |   |

### static::quotaProjectFromEnv

Fetch a quota project from the environment variable
GOOGLE_CLOUD_QUOTA_PROJECT. Return null if
GOOGLE_CLOUD_QUOTA_PROJECT is not specified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string|null` |   |

### static::getDefaultClientCertSource

Gets a callable which returns the default device certification.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `callable|null` |   |

### static::shouldLoadClientCertSource

Determines whether or not the default device certificate should be loaded.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

## Constants

### TOKEN_CREDENTIAL_URI

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

### ENV_VAR

```php
Value: 'GOOGLE_APPLICATION_CREDENTIALS'
```

### QUOTA_PROJECT_ENV_VAR

```php
Value: 'GOOGLE_CLOUD_QUOTA_PROJECT'
```

### WELL_KNOWN_PATH

```php
Value: 'gcloud/application_default_credentials.json'
```

### NON_WINDOWS_WELL_KNOWN_PATH_BASE

```php
Value: '.config'
```

### MTLS_WELL_KNOWN_PATH

```php
Value: '.secureConnect/context_aware_metadata.json'
```

### MTLS_CERT_ENV_VAR

```php
Value: 'GOOGLE_API_USE_CLIENT_CERTIFICATE'
```