Skip to content

Commit

Permalink
Change oauth2 client to set Authorization header
Browse files Browse the repository at this point in the history
  • Loading branch information
jirutka committed Dec 2, 2017
1 parent e743d4c commit 846d470
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kosapi_client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'fuubar', '~> 2.2.0'
spec.add_development_dependency 'simplecov'

spec.add_runtime_dependency 'oauth2'
spec.add_runtime_dependency 'oauth2', '~> 1.4'
spec.add_runtime_dependency 'faraday', '~> 0.9'
spec.add_runtime_dependency 'corefines', '~> 1.6'
spec.add_runtime_dependency 'escape_utils' unless RUBY_PLATFORM == 'java' # used for uri_template
Expand Down
8 changes: 7 additions & 1 deletion lib/kosapi_client/oauth2_http_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ def initialize(credentials, base_url, opts = {})
auth_url = opts[:auth_url] || DEFAULT_AUTH_URL
token_url = opts[:token_url] || DEFAULT_TOKEN_URL
MultiXml.parser = :ox # make sure to use Ox because of different namespace handling in other MultiXML parsers
@client = OAuth2::Client.new(credentials[:client_id], credentials[:client_secret], site: base_url, authorize_url: auth_url, token_url: token_url)
@client = OAuth2::Client.new(
credentials[:client_id],
credentials[:client_secret],
auth_scheme: :basic_auth,
site: base_url,
authorize_url: auth_url,
token_url: token_url)
end

def send_request(verb, url, options = {})
Expand Down

0 comments on commit 846d470

Please sign in to comment.