Module: Google::Auth::JsonKeyReader

Included in:
ServiceAccountCredentials, ServiceAccountJwtHeaderCredentials
Defined in:
lib/googleauth/json_key_reader.rb

Overview

JsonKeyReader contains the behaviour used to read private key and client email fields from the service account

Instance Method Summary collapse

Instance Method Details

#read_json_key(json_key_io) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/googleauth/json_key_reader.rb', line 37

def read_json_key json_key_io
  json_key = MultiJson.load json_key_io.read
  raise "missing client_email" unless json_key.key? "client_email"
  raise "missing private_key" unless json_key.key? "private_key"
  project_id = json_key["project_id"]
  [json_key["private_key"], json_key["client_email"], project_id]
end