An interesting note, perhaps. I was writing unit tests last night to check my 
OAuth implementation. I was able to connect and retrieve data via the regular 
API (api.twitter.com), but I still have the 401 issue when trying to connect to 
the user stream API.

On 2011-06-24, at 19:54, Eryn Wells wrote:

> Hello all,
> 
> I'm quite new to OAuth and the Twitter API, and this is my first post to this 
> list.
> 
> I'm working on an app in Python using the Twisted framework. It uses 
> brosner's fork of python-oauth2[1] to do the initial authentication and 
> subsequent request signing. I'm using the PIN code flow for authentication. 
> Do access tokens need to be generated every time you start the app, or can 
> they be stored between runs and reused? If so, how long are the valid? Right 
> now, my code writes the access token and secret out to a file and recovers it 
> the next time it starts. The procedure seems to go just fine – I don't get 
> any errors – but I can't really verify that everything is Correct because I 
> don't really know what I'm looking for…
> 
> Second thing, I'm at the point where I'm trying to do the initial connection 
> to https://userstream.twitter.com/2/user.json. I'm using SSLConnect and 
> web.HTTPClient, if that helps… I write out the command (GET <url>), and the 
> headers (a Host and an Authorization header). The OAuth library generates the 
> following Authorization header content. I get back a 401 Unauthorized error 
> with a WWW-Authenticate: Basic header. I've heard from @twitterapi that User 
> Streams require OAuth, so why am I getting a Basic auth response?
> 
> OAuth realm="Firehose", oauth_nonce="25622603816219309853125867384777", 
> oauth_consumer_key="<cut>", oauth_signature_method="HMAC-SHA1", 
> oauth_version="1.0", oauth_token="<cut>", 
> oauth_signature="1AV5YG4DsfCV4jDoQcOCOmxZ2Gw%3D"
> 
> Anything obvious there that I'm doing wrong?
> 
> Thanks,
> Eryn
> 
> -- 
> Twitter developer documentation and resources: https://dev.twitter.com/doc
> API updates via Twitter: https://twitter.com/twitterapi
> Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
> Change your membership to this group: 
> https://groups.google.com/forum/#!forum/twitter-development-talk

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk

Reply via email to