googleauth - Class Google::Auth::UserRefreshCredentials (v1.12.1)

Reference documentation and code samples for the googleauth class Google::Auth::UserRefreshCredentials.

Authenticates requests using User Refresh credentials.

This class allows authorizing requests from user refresh tokens.

This the end of the result of a 3LO flow. E.g, the end result of 'gcloud auth login' saves a file with these contents in well known location

cf Application Default Credentials

Methods

.make_creds

def self.make_creds(options = {})

Create a UserRefreshCredentials.

Parameters
  • json_key_io (IO) — an IO from which the JSON key can be read
  • scope (string|array|nil) — the scope(s) to access

.read_json_key

def self.read_json_key(json_key_io)

Reads the client_id, client_secret and refresh_token fields from the JSON key.

#includes_scope?

def includes_scope?(required_scope) -> Boolean

Verifies that a credential grants the requested scope

Parameter
  • required_scope (Array<String>, String) — Scope to verify
Returns
  • (Boolean) — True if scope is granted

#initialize

def initialize(options = {}) -> UserRefreshCredentials
Returns

#project_id

def project_id()

Returns the value of attribute project_id.

#quota_project_id

def quota_project_id()

Returns the value of attribute quota_project_id.

#revoke!

def revoke!(options = {})

Revokes the credential

Constants

TOKEN_CRED_URI

AUTHORIZATION_URI

REVOKE_TOKEN_URI