# Google Auth Library Client - Class CredentialsLoader (1.50.1)

1.50.1 (latest) 1.50.0 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

## 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[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/auth/latest/Credentials.ServiceAccountCredentials|https://docs.cloud.google.com/php/docs/reference/auth/latest/Credentials.UserRefreshCredentials|https://docs.cloud.google.com/php/docs/reference/auth/latest/Credentials.ImpersonatedServiceAccountCredentials|https://docs.cloud.google.com/php/docs/reference/auth/latest/Credentials.ExternalAccountCredentials` |   |

### static::makeHttpClient

Create an authorized HTTP Client from an instance of FetchAuthTokenInterface.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fetcher` | `https://docs.cloud.google.com/php/docs/reference/auth/latest/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** |
| `https://docs.cloud.google.com/php/docs/reference/auth/latest/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

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

### ENV_VAR

    Value: 'GOOGLE_APPLICATION_CREDENTIALS'

### QUOTA_PROJECT_ENV_VAR

    Value: 'GOOGLE_CLOUD_QUOTA_PROJECT'

### WELL_KNOWN_PATH

    Value: 'gcloud/application_default_credentials.json'

### NON_WINDOWS_WELL_KNOWN_PATH_BASE

    Value: '.config'

### MTLS_WELL_KNOWN_PATH

    Value: '.secureConnect/context_aware_metadata.json'

### MTLS_CERT_ENV_VAR

    Value: 'GOOGLE_API_USE_CLIENT_CERTIFICATE'