module DvelpFlow::Google::Auth::Token
Public Class Methods
fetch!()
click to toggle source
# File lib/dvelp_flow/google/auth/token.rb, line 7 def fetch! cache_key = 'google/auth/token/fetch' DvelpFlow.cache.fetch(cache_key, expires_in: 30.minutes) do scope = 'https://www.googleapis.com/auth/cloud-platform' keyfile = ENV.fetch('GOOGLE_CLOUD_KEYFILE_JSON', '') authorizer = ::Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: StringIO.new(keyfile), scope: scope ) authorizer.fetch_access_token!['access_token'] end end
Private Instance Methods
fetch!()
click to toggle source
# File lib/dvelp_flow/google/auth/token.rb, line 7 def fetch! cache_key = 'google/auth/token/fetch' DvelpFlow.cache.fetch(cache_key, expires_in: 30.minutes) do scope = 'https://www.googleapis.com/auth/cloud-platform' keyfile = ENV.fetch('GOOGLE_CLOUD_KEYFILE_JSON', '') authorizer = ::Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: StringIO.new(keyfile), scope: scope ) authorizer.fetch_access_token!['access_token'] end end