1.17.8 (latest) 1.17.7 1.16.2 1.15.1 1.14.0 1.13.1 1.12.2 Reference documentation and code samples for the googleauth module Google::Auth::CredentialsLoader.

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

## Included In

- [Google::Auth::DefaultCredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-DefaultCredentials.md.txt)
- [Google::Auth::ExternalAccount::AwsCredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-ExternalAccount-AwsCredentials.md.txt)
- [Google::Auth::ExternalAccount::IdentityPoolCredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-ExternalAccount-IdentityPoolCredentials.md.txt)
- [Google::Auth::ExternalAccount::PluggableAuthCredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-ExternalAccount-PluggableAuthCredentials.md.txt)
- [Google::Auth::ServiceAccountCredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-ServiceAccountCredentials.md.txt)
- [Google::Auth::ServiceAccountJwtHeaderCredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-ServiceAccountJwtHeaderCredentials.md.txt)
- [Google::Auth::UserRefreshCredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-UserRefreshCredentials.md.txt)

## Methods

### .load_gcloud_project_id

```ruby
def self.load_gcloud_project_id()
```
Finds project_id from gcloud CLI configuration

### #from_env

```ruby
def from_env(scope = nil, options = {})
```
Creates an instance from the path specified in an environment
variable.
**Parameters**

- **scope** (string\|array\|nil) --- the scope(s) to access
- **options** (Hash) ---

  Connection options. These may be used to configure
  how OAuth tokens are retrieved, by providing a suitable
  `Faraday::Connection`. For example, if a connection proxy must be
  used in the current network, you may provide a connection with
  with the needed proxy options.
  The following keys are recognized:
  - `:default_connection` The connection object to use.
  - `:connection_builder` A `Proc` that returns a connection.
**Raises**

- ([Google::Auth::InitializationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-InitializationError.md.txt)) --- If the credentials file cannot be read

### #from_system_default_path

```ruby
def from_system_default_path(scope = nil, options = {})
```
Creates an instance from the system default path
**Parameters**

- **scope** (string\|array\|nil) --- the scope(s) to access
- **options** (Hash) ---

  Connection options. These may be used to configure
  how OAuth tokens are retrieved, by providing a suitable
  `Faraday::Connection`. For example, if a connection proxy must be
  used in the current network, you may provide a connection with
  with the needed proxy options.
  The following keys are recognized:
  - `:default_connection` The connection object to use.
  - `:connection_builder` A `Proc` that returns a connection.
**Raises**

- ([Google::Auth::InitializationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-InitializationError.md.txt)) --- If the credentials file cannot be read or is invalid

### #from_well_known_path

```ruby
def from_well_known_path(scope = nil, options = {})
```
Creates an instance from a well known path.
**Parameters**

- **scope** (string\|array\|nil) --- the scope(s) to access
- **options** (Hash) ---

  Connection options. These may be used to configure
  how OAuth tokens are retrieved, by providing a suitable
  `Faraday::Connection`. For example, if a connection proxy must be
  used in the current network, you may provide a connection with
  with the needed proxy options.
  The following keys are recognized:
  - `:default_connection` The connection object to use.
  - `:connection_builder` A `Proc` that returns a connection.
**Raises**

- ([Google::Auth::InitializationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-InitializationError.md.txt)) --- If the credentials file cannot be read

### #make_creds

```ruby
def make_creds(*args)
```
make_creds proxies the construction of a credentials instance


<br />

By default, it calls #new on the current class, but this behaviour can
be modified, allowing different instances to be created.

## Constants

### ENV_VAR

**value:**"GOOGLE_APPLICATION_CREDENTIALS".freeze

### PRIVATE_KEY_VAR

**value:**"GOOGLE_PRIVATE_KEY".freeze

### CLIENT_EMAIL_VAR

**value:**"GOOGLE_CLIENT_EMAIL".freeze

### CLIENT_ID_VAR

**value:**"GOOGLE_CLIENT_ID".freeze

### CLIENT_SECRET_VAR

**value:**"GOOGLE_CLIENT_SECRET".freeze

### REFRESH_TOKEN_VAR

**value:**"GOOGLE_REFRESH_TOKEN".freeze

### ACCOUNT_TYPE_VAR

**value:**"GOOGLE_ACCOUNT_TYPE".freeze

### PROJECT_ID_VAR

**value:**"GOOGLE_PROJECT_ID".freeze

### AWS_REGION_VAR

**value:**"AWS_REGION".freeze

### AWS_DEFAULT_REGION_VAR

**value:**"AWS_DEFAULT_REGION".freeze

### AWS_ACCESS_KEY_ID_VAR

**value:**"AWS_ACCESS_KEY_ID".freeze

### AWS_SECRET_ACCESS_KEY_VAR

**value:**"AWS_SECRET_ACCESS_KEY".freeze

### AWS_SESSION_TOKEN_VAR

**value:**"AWS_SESSION_TOKEN".freeze

### GCLOUD_POSIX_COMMAND

**value:**"gcloud".freeze

### GCLOUD_WINDOWS_COMMAND

**value:**"gcloud.cmd".freeze

### GCLOUD_CONFIG_COMMAND

**value:**"config config-helper --format json --verbosity none --quiet".freeze

### CREDENTIALS_FILE_NAME

**value:**"application_default_credentials.json".freeze

### NOT_FOUND_ERROR

**value:** "Unable to read the credential file specified by #[ENV_VAR](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-CredentialsLoader.md.txt#Google__Auth__CredentialsLoader__ENV_VAR "Google::Auth::CredentialsLoader::ENV_VAR (constant)")".freeze

### WELL_KNOWN_PATH

**value:** "gcloud/#[CREDENTIALS_FILE_NAME](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-CredentialsLoader.md.txt#Google__Auth__CredentialsLoader__CREDENTIALS_FILE_NAME "Google::Auth::CredentialsLoader::CREDENTIALS_FILE_NAME (constant)")".freeze

### WELL_KNOWN_ERROR

**value:**"Unable to read the default credential file".freeze

### SYSTEM_DEFAULT_ERROR

**value:**"Unable to read the system default credential file".freeze

### CLOUD_SDK_CLIENT_ID

**value:**"764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.app" \\
"s.googleusercontent.com".freeze