Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Resolves #75 #78

Merged
1 commit merged into from

2 participants

@laserlemon
Collaborator

This resolves the issue with generating an invalid OAuth signature for non-GET requests. However, ROAuth is botching the signature independently of #75 when sending parameters that require URL encoding. I'll be submitting a fix to them next.

@sferik
Owner

Thanks for this fix! I wonder how we can test to make sure requests are signed correctly?

@laserlemon
Collaborator

The ROAuth gem is able to verify incoming OAuth requests as well. That's what I'd recommend.

@sferik
Owner

Are such tests something you'd be interested in working on? You seem like the expert on roauth. :)

@laserlemon
Collaborator

Ha, sure. I'll take a stab at it.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 9, 2010
  1. @laserlemon

    Building an OAuth header requires knowing the HTTP method and does no…

    laserlemon authored
    …t require query variables on the URL.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/twitter/base.rb
View
12 lib/twitter/base.rb
@@ -468,20 +468,20 @@ def connection_with_builders(builders)
@connection
end
- def oauth_header(path, options)
+ def oauth_header(path, options, method)
oauth_params = {
:consumer_key => self.consumer_key,
:consumer_secret => self.consumer_secret,
:access_key => self.access_key,
:access_secret => self.access_secret
}
- ROAuth.header(oauth_params, connection.build_url(path, options), options)
+ ROAuth.header(oauth_params, connection.build_url(path), options, method)
end
def perform_get(path, options={})
results = connection.get do |request|
request.url path, options
- request['Authorization'] = oauth_header(path, options)
+ request['Authorization'] = oauth_header(path, options, :get)
end.body
end
@@ -489,7 +489,7 @@ def perform_post(path, options={})
results = connection.post do |request|
request.path = path
request.body = options
- request['Authorization'] = oauth_header(path, {})
+ request['Authorization'] = oauth_header(path, options, :post)
end.body
end
@@ -497,14 +497,14 @@ def perform_put(path, options={})
results = connection.put do |request|
request.path = path
request.body = options
- request['Authorization'] = oauth_header(path, options)
+ request['Authorization'] = oauth_header(path, options, :put)
end.body
end
def perform_delete(path, options={})
results = connection.delete do |request|
request.url path, options
- request['Authorization'] = oauth_header(path, options)
+ request['Authorization'] = oauth_header(path, options, :delete)
end.body
end
Something went wrong with that request. Please try again.