class Google::Auth::ServiceAccountCredentials

Overview

Service Account (JWT) credentials for server-to-server authentication.

creds = Google::Auth::ServiceAccountCredentials.from_json_key("key.json", scope: Google::Auth::Scopes::YOUTUBE)
youtube = Google::Apis::YoutubeV3::YouTubeService.new
youtube.authorize(creds)

Defined in:

google/auth/service_account.cr

Constant Summary

GOOGLE_TOKEN_URL = "oauth2.googleapis.com"
GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer"
TOKEN_PATH = "/token"

Constructors

Instance Method Summary

Constructor Detail

def self.from_json_key(json_key_path : String, scope : String | Array(String)) : ServiceAccountCredentials #

[View source]
def self.new(client_email : String, private_key : String, scope : String, token_uri : String = "https://#{GOOGLE_TOKEN_URL}#{TOKEN_PATH}") #

[View source]

Instance Method Detail

def access_token : String | Nil #

[View source]
def access_token=(access_token : String | Nil) #

[View source]
def client_email : String #

[View source]
def client_email=(client_email : String) #

[View source]
def expired? : Bool #

[View source]
def expires_at : Time | Nil #

[View source]
def expires_at=(expires_at : Time | Nil) #

[View source]
def private_key : String #

[View source]
def private_key=(private_key : String) #

[View source]
def refresh! : String #

[View source]
def scope : String #

[View source]
def scope=(scope : String) #

[View source]
def token_uri : String #

[View source]
def token_uri=(token_uri : String) #

[View source]
def valid_token : String #

[View source]