class BooticClient::Strategies::Authorized
Private Instance Methods
auth()
click to toggle source
# File lib/bootic_client/strategies/authorized.rb, line 33 def auth @auth ||= OAuth2::Client.new('', '', site: config.auth_host) end
get_token()
click to toggle source
# File lib/bootic_client/strategies/authorized.rb, line 15 def get_token # The JWT grant must have an expiration date, in seconds since the epoch. # For most cases a few seconds should be enough. exp = Time.now.utc.to_i + 30 # Use the "assertion" flow to exchange the JWT grant for an access token access_token = auth.assertion.get_token( hmac_secret: config.client_secret, iss: config.client_id, prn: client.options[:access_token], aud: 'api', exp: exp, scope: '' ) access_token.token end
validate!()
click to toggle source
# File lib/bootic_client/strategies/authorized.rb, line 11 def validate! raise ArgumentError, 'options MUST include access_token' unless options[:access_token] end