googleauth - Module Google::Auth (v1.12.2) Stay organized with collections Save and categorize content based on your preferences.
Reference documentation and code samples for the googleauth module Google::Auth.
Module Auth provides classes that provide Google-specific authorization used to access Google APIs.
Methods
.get_application_default
defself.get_application_default(scope=nil,options={})Obtains the default credentials implementation to use in thisenvironment.
Use this to obtain the Application Default Credentials for accessingGoogle APIs. Application Default Credentials are described in detailathttps://cloud.google.com/docs/authentication/production.
If supplied, scope is used to create the credentials instance, when it canbe applied. E.g, on google compute engine and for user credentials thescope is ignored.
- scope (string|array|nil) — the scope(s) to access
- options (Hash) —
Connection options. These may be used to configurethe
Faraday::Connectionused for outgoing HTTP requests. Forexample, 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_connectionThe connection object to use for tokenrefresh requests.:connection_builderAProcthat creates and returns aconnection to use for token refresh requests.:connectionThe connection to use to determine whether GCEmetadata credentials are available.
- (NOT_FOUND_ERROR)
Constants
VERSION
value:"1.12.2".freeze
NO_METADATA_SERVER_ERROR
value:<<~ERROR.freeze Error code 404 trying to get security access token from Compute Engine metadata for the default service account. This may be because the virtual machine instance does not have permission scopes specified.ERROR
UNEXPECTED_ERROR_SUFFIX
value:<<~ERROR.freeze trying to get security access token from Compute Engine metadata for the default service accountERROR
NOT_FOUND_ERROR
value:<<~ERROR_MESSAGE.freeze Your credentials were not found. To set up Application Default Credentials for your environment, seehttps://cloud.google.com/docs/authentication/external/set-up-adcERROR_MESSAGE
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.