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
-
#read_json_key(json_key_io) ⇒ Array(String, String, String, String, String)
Reads a JSON key from an IO object and extracts common fields.
Instance Method Details
#read_json_key(json_key_io) ⇒ Array(String, String, String, String, String)
Reads a JSON key from an IO object and extracts common fields.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/googleauth/json_key_reader.rb', line 31 def read_json_key json_key_io json_key = MultiJson.load json_key_io.read raise InitializationError, "missing client_email" unless json_key.key? "client_email" raise InitializationError, "missing private_key" unless json_key.key? "private_key" [ json_key["private_key"], json_key["client_email"], json_key["project_id"], json_key["quota_project_id"], json_key["universe_domain"] ] end |