MMISoftware Blog
News and views of Mac OS X and iPhone Programming
 
 

Twitter has finally turned off all basic authentication and gone over to using oauth. I knew this was coming, I had no excuse to wait to upgrade various Twitter scripts used by MMISoftware, and also the plugins on the range of blogs we host, but I did. So, what did I learn?

First, don’t wait until the last minute!

Upgrading Applescripts: This was interesting. In basic authentication you could just use curl, but with oath this was not the case. It turns out the solution was (for me) to use twurlsource. The twurl site does a good job of explaining the process. Basically, install twurl (in terminal) with:

sudo gem install twurl

and then authorise twurl with:

$ twurl authorize --consumer-key the-key --consumer-secret the-secret

Where the-key and the-secret are obtained from the Twitter Developer site, and are specific for your Twitter account.

Once the-key and the-secret are added to twurl you are prompted for a pin that is obtained via the Twitter Developer site. All fairly straight forward.

To use twurl from the command-line you just type:

twurl -d "status=This is a twurl test" /1/statuses/update.xml

which will post ‘This is a twurl test’ to the Twitter account you used to set up twurl on the Twitter Developer site.

You can then use twurl in your AppleScript by using a ‘do shell script’. For example:

set results to do shell script "twurl -d " & twitter_status & " /1/statuses/update.xml"

where twitter_status could be ‘status=Testing twurl with a location&lat=37.7821120598956&long=-122.400612831116′, which would ‘geolocate’ (geocode) the Twitter post ‘Testing twurl with a location’ with the latitude and longitude coordinates 37.7821120598956 and -122.400612831116, respectively.

Upgrading the blogs: I use the excellent Twitter Tools By Crowd Favorite, these work great. Twitter Tools post tweets of new blog posts, and log tweets back to your blog. This all worked great with basic authentication and version 2.4 seems to work very well with oauth. Crowd Favorite have done a very good job with their instructions to walk you through the process of getting your site registered at Twitter Developer, and getting all the various keys and tokens needed to get oauth working. Thanks….

Leave a Reply

Search


 

Subscribe

    Subscribe to MMI news

    Enter your email address:

    Delivered by FeedBurner

    AddThis Social Bookmark Button
 

Categories

 

Archives

 

Spam caught:

 
 

MMISoftware Blog is proudly powered by WordPress
Domain services and hosting by MMISoftware
Entries (RSS) and Comments (RSS).