googleauth - Class Google::Auth::ServiceAccountCredentials (v1.12.2)

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

Authenticates requests using Google's Service Account credentials via an OAuth access token.

This class allows authorizing requests for service accounts directly from credentials from a json key file downloaded from the developer console (via 'Generate new Json Key').

cf Application Default Credentials

Methods

.make_creds

  def 
  
 self 
 . 
 make_creds 
 ( 
 options 
  
 = 
  
 {}) 
 

Creates a ServiceAccountCredentials.

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

.unescape

  def 
  
 self 
 . 
 unescape 
 ( 
 str 
 ) 
 

Handles certain escape sequences that sometimes appear in input. Specifically, interprets the "\n" sequence for newline, and removes enclosing quotes.

#apply!

  def 
  
 apply! 
 ( 
 a_hash 
 , 
  
 opts 
  
 = 
  
 {}) 
 

Extends the base class to use a transient ServiceAccountJwtHeaderCredentials for certain cases.

#enable_self_signed_jwt?

  def 
  
 enable_self_signed_jwt? 
 () 
  
 - 
>  
 Boolean 
 
Returns
  • (Boolean)

#initialize

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

#needs_access_token?

  def 
  
 needs_access_token? 
 () 
  
 - 
>  
 Boolean 
 

Modifies this logic so it also requires self-signed-jwt to be disabled

Returns
  • (Boolean)

#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.

Constants

TOKEN_CRED_URI

Design a Mobile Site
View Site in Mobile | Classic
Share by: