googleauth - Module Google::Auth::CredentialsLoader (v1.15.1)

Reference documentation and code samples for the googleauth module Google::Auth::CredentialsLoader.

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

Methods

.load_gcloud_project_id

defself.load_gcloud_project_id()

Finds project_id from gcloud CLI configuration

#from_env

deffrom_env(scope=nil,options={})

Creates an instance from the path specified in an environmentvariable.

Parameters
  • scope (string|array|nil) — the scope(s) to access
  • options (Hash) —

    Connection options. These may be used to configurehow OAuth tokens are retrieved, by providing a suitableFaraday::Connection. For example, if a connection proxy must beused in the current network, you may provide a connection withwith the needed proxy options.The following keys are recognized:

    • :default_connection The connection object to use.
    • :connection_builder AProc that returns a connection.
Raises

#from_system_default_path

deffrom_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 configurehow OAuth tokens are retrieved, by providing a suitableFaraday::Connection. For example, if a connection proxy must beused in the current network, you may provide a connection withwith the needed proxy options.The following keys are recognized:

    • :default_connection The connection object to use.
    • :connection_builder AProc that returns a connection.
Raises

#from_well_known_path

deffrom_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 configurehow OAuth tokens are retrieved, by providing a suitableFaraday::Connection. For example, if a connection proxy must beused in the current network, you may provide a connection withwith the needed proxy options.The following keys are recognized:

    • :default_connection The connection object to use.
    • :connection_builder AProc that returns a connection.
Raises

#make_creds

defmake_creds(*args)

make_creds proxies the construction of a credentials instance

By default, it calls #new on the current class, but this behaviour canbe 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".freeze

WELL_KNOWN_PATH

value:"gcloud/#CREDENTIALS_FILE_NAME".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

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.