class Google::Auth::UserRefreshCredentials

def self.make_creds options = {}

Parameters:
  • scope (string|array|nil) -- the scope(s) to access
  • json_key_io (IO) -- an IO from which the JSON key can be read
def self.make_creds options = {}
  json_key_io, scope = options.values_at :json_key_io, :scope
  user_creds = read_json_key json_key_io if json_key_io
  user_creds ||= {
    "client_id"     => ENV[CredentialsLoader::CLIENT_ID_VAR],
    "client_secret" => ENV[CredentialsLoader::CLIENT_SECRET_VAR],
    "refresh_token" => ENV[CredentialsLoader::REFRESH_TOKEN_VAR],
    "project_id"    => ENV[CredentialsLoader::PROJECT_ID_VAR],
    "quota_project_id" => nil,
    "universe_domain" => nil
  }
  new(token_credential_uri: TOKEN_CRED_URI,
      client_id:            user_creds["client_id"],
      client_secret:        user_creds["client_secret"],
      refresh_token:        user_creds["refresh_token"],
      project_id:           user_creds["project_id"],
      quota_project_id:     user_creds["quota_project_id"],
      scope:                scope,
      universe_domain:      user_creds["universe_domain"] || "googleapis.com")
    .configure_connection(options)
end