Back in 2009 I wrote this little Ruby script I run Mondays to grab the last week’s tweets and publish them into the Short-form Fragments stream here on the blog, because who knows when Twitter might make my history vanish? It broke today and I fixed it and had another instructive OAuth experience.

The error message was a 404 on something called user_timeline.xml; a bit of poking around produced contradictory evidence, but some of it was that this had been deprecated in favor of a JSON version. I was a little irritated but not too much; I’d been using XPath probes to pull the interesting bits out of the XML, and tweets aren’t document-like at all, so JSON should be a better fit.

It was even easier than I expected; the Twitter Ruby Gem has grown up. As for the OAuth part, you need to do the following:

Twitter.configure do |config|
  config.consumer_key = YOUR_CONSUMER_KEY
  config.consumer_secret = YOUR_CONSUMER_SECRET
  config.oauth_token = YOUR_OAUTH_TOKEN
  config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end

Then it all Just Works. And since it’s all going server-to-server over TLS, it’s Pretty Damn Secure. This is what Internet Identity should be like.

Thanks to John Nunemaker, Wynn Netherland, Erik Michaels-Ober, and Steve Richert.



Contributions

Comment feed for ongoing:Comments feed

From: Kevin H (Oct 17 2012, at 21:00)

Hm, "easy" does not appear to be a universally agreed upon label. See:

http://www.russellbeattie.com/blog/twitterfeedphp-get-your-authenticated-twitter-stream-as-an-atom-feed

Russell says, "OAuth has so many moving parts, it's nearly impossible to get it formatted and authenticated correctly."

[link]

author · Dad · software · colophon · rights
picture of the day
October 15, 2012
· Technology (85 fragments)
· · Identity (41 more)

By

I am an employee of Amazon.com, but the opinions expressed here are my own, and no other party necessarily agrees with them.

A full disclosure of my professional interests is on the author page.