Many Pies

Many Pies

Friday, May 21, 2010

Display a tweet on a web page - getting around the authentication restrictions

I was working on the Engage page on our website and I wanted to display a single tweet from a particular user. It was a lot more complicated than I thought.
An old version of a similar page used the query (with a bit of JQuery around it)
http://twitter.com/statuses/user_timeline/...

Although that still works, I suspect it will be deprecated. The latest version
http://api.twitter.com/statuses/1/user_timeline/...
requires authentication. That's soon going to require OAuth. It wasn't easy to find much stuff about OAuth and twitter and javascript. Eventually I did find some wisdom about how it was a bad idea on javascript, because it means putting secrets in your code.

So my work around was to create a list with the same name as the user I wanted to display on our corporate twitter account, add that twitter user to it, and use
 http://api.twitter.com/1/user/lists/...
instead. It doesn't require authentication, so works fine!
Post a Comment