googleauth - Class Google::Auth::GCECredentials (v1.15.1)

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.

Methods

.on_gce?

defself.on_gce?(_options={},_reload=false)->Boolean

Detect if this appear to be a GCE instance, by checking if metadatais available.The parameters are deprecated and unused.

Returns
  • (Boolean)

.reset_cache

defself.reset_cache()

.unmemoize_all

defself.unmemoize_all()
Alias Of:.reset_cache

#duplicate

defduplicate(options={})

Creates a duplicate of these credentialswithout the Signet::OAuth2::Client-specifictransient state (e.g. cached tokens)

Parameter
  • options (Hash) —

    Overrides for the credentials parameters.The following keys are recognized in addition to keys in theSignet::OAuth2::Client

    • :universe_domain_overridden Whether the universe domain wasoverriden during credentials creation

#fetch_access_token

deffetch_access_token(_options={})->Hash

Overrides the super class method to change how access tokens arefetched.

Parameter
  • _options (Hash) — Options for token fetch (not used)
Returns
  • (Hash) — The token data hash
Raises

#initialize

definitialize(options={})->GCECredentials

Construct a GCECredentials

Returns

#update!

defupdate!(options={})->Google::Auth::GCECredentials

Destructively updates these credentials.

This method is called bySignet::OAuth2::Client's constructor

Parameter
  • options (Hash) —

    Overrides for the credentials parameters.The following keys are recognized in addition to keys in theSignet::OAuth2::Client

    • :universe_domain_overridden Whether 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.