module Google::Auth::JsonKeyReader

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

Public Instance Methods

read_json_key(json_key_io) click to toggle source
# 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