googleauth - Class Google::Auth::GCECredentials (v1.15.1) Stay organized with collections Save and categorize content based on your preferences.
Reference documentation and code samples for the googleauth class Google::Auth::GCECredentials.
Extends Signet::OAuth2::Client so that the auth token is obtained fromthe GCE metadata server.
Inherits
Methods
.on_gce?
defself.on_gce?(_options={},_reload=false)->BooleanDetect if this appear to be a GCE instance, by checking if metadatais available.The parameters are deprecated and unused.
- (Boolean)
.reset_cache
defself.reset_cache().unmemoize_all
defself.unmemoize_all()#duplicate
defduplicate(options={})Creates a duplicate of these credentialswithout the Signet::OAuth2::Client-specifictransient state (e.g. cached tokens)
- options (Hash) —
Overrides for the credentials parameters.The following keys are recognized in addition to keys in theSignet::OAuth2::Client
:universe_domain_overriddenWhether the universe domain wasoverriden during credentials creation
#fetch_access_token
deffetch_access_token(_options={})->HashOverrides the super class method to change how access tokens arefetched.
- _options (Hash) — Options for token fetch (not used)
- (Hash) — The token data hash
- (Google::Auth::UnexpectedStatusError) — On unexpected HTTP status codes
- (Google::Auth::AuthorizationError) — If metadata server is unavailable or returns error
#initialize
definitialize(options={})->GCECredentialsConstruct a GCECredentials
- (GCECredentials) — a new instance of GCECredentials
#update!
defupdate!(options={})->Google::Auth::GCECredentialsDestructively updates these credentials.
This method is called bySignet::OAuth2::Client's constructor
- options (Hash) —
Overrides for the credentials parameters.The following keys are recognized in addition to keys in theSignet::OAuth2::Client
:universe_domain_overriddenWhether the universe domain wasoverriden during credentials creation
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.