Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream search API with track=#HASHTAG returns "401 Unauthorized" #14

Merged
merged 1 commit into from
Jun 22, 2011
Merged

Conversation

kou
Copy link
Contributor

@kou kou commented May 31, 2011

OAuth uses HTTP method, URL and request parameters to generate signature. So Twitter::JSONStream and SimpleOAuth::Header use the same request parameters. But the current code doesn't use the same request parameters. So request to http://stream.twitter.com/1/statuses/filter.json with track=#HASH_TAG request parameter and OAuth gets "401 Unauthorized".

Twitter::JSONStream#params returns escaped parameters and passes it to SimpleOAuth::Header. And SimpleOAuth::Header also escaped passed parameters. This is the problem. Twitter::JSONStream should pass not escaped parameters SimpleOAuth::Header.

Here is a sample code:
stream_options = {
:oauth => { ... },
:host => "stream.twitter.com",
:path => "/1/statuses/filter.json",
:method => "POST",
:filters => "#twitter",
}
stream = Twitter::JSONStream.connect(stream_options) # this stream will get "401 Unauthorized"

FYI: Streaming API document: http://dev.twitter.com/pages/streaming_api_methods#statuses-filter

@stve
Copy link
Contributor

stve commented Jun 7, 2011

+1 i've tested this and it's working well for me.

voloko added a commit that referenced this pull request Jun 22, 2011
Stream search API with track=#HASHTAG returns "401 Unauthorized"
@voloko voloko merged commit 3e274b3 into voloko:master Jun 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants