class OmniAuth::Strategies::Shootproof

Public Instance Methods

raw_info() click to toggle source
# File lib/omniauth/strategies/shootproof.rb, line 44
def raw_info
  @raw_info ||= {
    token:         access_token.token,
    refresh_token: access_token.refresh_token,
    expires_at: access_token.expires_at,
    expires_in: access_token.expires_in
  }
end

Protected Instance Methods

callback_url() click to toggle source
# File lib/omniauth/strategies/shootproof.rb, line 58
def callback_url
  full_host + script_name + callback_path
end
client() click to toggle source
# File lib/omniauth/strategies/shootproof.rb, line 54
def client
  OmniAuth::Shootproof::Client.new(options.client_id, options.client_secret, deep_symbolize(options.client_options))
end
get_token(params, access_token_opts = {}, access_token_class = ::OAuth2::AccessToken) click to toggle source

Initializes an AccessToken by making a request to the token endpoint

@param [Hash] params a Hash of params for the token endpoint @param [Hash] access token options, to pass to the AccessToken object @param [Class] class of access token for easier subclassing OAuth2::AccessToken @return [AccessToken] the initalized AccessToken

# File lib/omniauth/strategies/shootproof.rb, line 68
def get_token(params, access_token_opts = {}, access_token_class = ::OAuth2::AccessToken) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  params = Authenticator.new(id, secret, options[:auth_scheme]).apply(params)
  opts = {:raise_errors => options[:raise_errors], :parse => params.delete(:parse)}
  headers = params.delete(:headers) || {}
  opts[:params] = params
  opts[:params].merge!(redirection_params)
  opts[:headers] = {'Content-Type' => 'application/x-www-form-urlencoded'}
  opts[:headers].merge!(headers)
  response = request(options[:token_method], token_url, opts)
  if options[:raise_errors] && !(response.parsed.is_a?(Hash) && response.parsed['access_token'])
    error = Error.new(response)
    raise(error)
  end
  access_token_class.from_hash(self, response.parsed.merge(access_token_opts))
end