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 class Google::Auth::GCECredentials.

Extends Signet::OAuth2::Client so that the auth token is obtained from
the GCE metadata server.

## Inherits

- [Signet::OAuth2::Client](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Signet-OAuth2-Client.md.txt)

## Methods

### .on_gce?

```ruby
def self.on_gce?(_options = {}, _reload = false) -> Boolean
```
Detect if this appear to be a GCE instance, by checking if metadata
is available.
The parameters are deprecated and unused.
**Returns**

- (Boolean)

### .reset_cache

```ruby
def self.reset_cache()
```
**Aliases**

- [.unmemoize_all](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-GCECredentials.md.txt#Google__Auth__GCECredentials_unmemoize_all_class_)

### .unmemoize_all

```ruby
def self.unmemoize_all()
```
**Alias Of** : [.reset_cache](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-GCECredentials.md.txt#Google__Auth__GCECredentials_reset_cache_class_)

### #duplicate

```ruby
def duplicate(options = {})
```
Creates a duplicate of these credentials
without the Signet::OAuth2::Client-specific
transient state (e.g. cached tokens)
**Parameter**

- **options** (Hash) ---

  Overrides for the credentials parameters.
  The following keys are recognized in addition to keys in the
  Signet::OAuth2::Client
  - `:universe_domain_overridden` Whether the universe domain was overriden during credentials creation

### #fetch_access_token

```ruby
def fetch_access_token(_options = {}) -> Hash
```
Overrides the super class method to change how access tokens are
fetched.
**Parameter**

- **_options** (Hash) --- Options for token fetch (not used)
**Returns**

- (Hash) --- The token data hash
**Raises**

- ([Google::Auth::UnexpectedStatusError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-UnexpectedStatusError.md.txt)) --- On unexpected HTTP status codes
- ([Google::Auth::AuthorizationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-AuthorizationError.md.txt)) --- If metadata server is unavailable or returns error

### #initialize

```ruby
def initialize(options = {}) -> GCECredentials
```
Construct a GCECredentials
**Returns**

- ([GCECredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-GCECredentials.md.txt)) --- a new instance of GCECredentials

### #update!

```ruby
def update!(options = {}) -> Google::Auth::GCECredentials
```
Destructively updates these credentials.


<br />

This method is called by `Signet::OAuth2::Client`'s constructor
**Parameter**

- **options** (Hash) ---

  Overrides for the credentials parameters.
  The following keys are recognized in addition to keys in the
  Signet::OAuth2::Client
  - `:universe_domain_overridden` Whether the universe domain was overriden during credentials creation
**Returns**

- ([Google::Auth::GCECredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-GCECredentials.md.txt))