Sha256: a61d3204ac85ea0be3de265cb3c7a4d8107fc287c5296bc755ffa815eaf6d7ae
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'omniauth-oauth2' # require 'multi_json' module OmniAuth module Strategies class Clio < OmniAuth::Strategies::OAuth2 option :name, "clio" option :client_options, { :site => 'https://app.goclio.com', :authorize_url => '/oauth/authorize', :token_url => '/oauth/access_token' } def authorize_params super.tap do |params| params[:response_type] = "code" params[:client_id] = client.id params[:redirect_uri] ||= callback_url end end def request_phase super end def build_access_token token_params = { :code => request.params['code'], :redirect_uri => callback_url, :client_id => client.id, :client_secret => client.secret, :grant_type => 'authorization_code' } client.get_token(token_params) end extra do {:raw_info => raw_info} end def raw_info access_token.options[:mode] = :query access_token.options[:param_name] = :access_token @raw_info ||= access_token.get('https://app.goclio.com/api/v1/users/who_am_i').parsed end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-clio-0.0.14 | lib/omniauth/strategies/Clio.rb |