-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a custom OAuth implementation to deal with Twitter's off specif…
…ication implementation
- Loading branch information
1 parent
55c8aef
commit 5d2e7cc
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'faraday' | ||
|
||
module Faraday | ||
class Request::OAuth < Faraday::Middleware | ||
dependency 'simple_oauth' | ||
|
||
def call(env) | ||
params = env[:body] || {} | ||
signature_params = params | ||
|
||
params.map{ |k,v| signature_params = {} if v.respond_to?(:content_type) } | ||
|
||
header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options) | ||
|
||
env[:request_headers]['Authorization'] = header.to_s | ||
|
||
@app.call(env) | ||
end | ||
|
||
def initialize(app, options) | ||
@app, @options = app, options | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters