Class: Google::APIClient::ComputeServiceAccount

Inherits:
Signet::OAuth2::Client
  • Object
show all
Defined in:
lib/google/api_client/auth/compute_service_account.rb

Instance Method Summary collapse

Instance Method Details

#fetch_access_token(options = {}) ⇒ Object



21
22
23
24
25
# File 'lib/google/api_client/auth/compute_service_account.rb', line 21

def fetch_access_token(options={})
  connection = options[:connection] || Faraday.default_connection
  response = connection.get 'http://metadata/computeMetadata/v1beta1/instance/service-accounts/default/token'
  Signet::OAuth2.parse_credentials(response.body, response.headers['content-type'])
end