Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which OAuth library do you find works best for Objective-C/iPhone?

I have been looking to switch to OAuth for my Twitter integration code and now that there is a deadline in less than 7 weeks (see countdown link) it is even more important to make the jump to OAuth. I have been doing Basic Authentication which is extremely easy. Unfortunately OAuth does not appear to be something that I would whip together in a couple of hours.

http://www.countdowntooauth.com/

So I am looking to use a library. I have put together the following list.

  • MPOAuth
  • MGTwitterEngine
  • OAuthConsumer

I see that MPOAuth has some great features with a good deal of testing code in place but there is one big problem. It does not work. The sample iPhone project that is supposed to authenticate with Twitter causes an error which others have identified and logged as a bug.

http://code.google.com/p/mpoauthconnection/issues/detail?id=29

The last code change was March 11 and this bug was filed on March 30. It has been over a month and this critical bug has not been fixed yet. So I have moved on to MGTwitterEngine.

I pulled down the source code and loaded it up in Xcode. Immediately I find that there are a few dependencies and the README file does not have a clear list of steps to fetch those dependencies and integrate them with the project so that it builds successfully. I see this as a sign that the project is not mature enough for prime time. I see also that the project references 2 libraries for JSON when one should be enough. One is TouchJSON which has worked well for me so I am again discouraged from relying on this project for my applications.

I did find that MGTwitterEngine makes use of OAuthConsumer which is one of many OAuth projects hosted by an OAuth project on Google Code.

  • http://code.google.com/p/oauth/
  • http://code.google.com/p/oauthconsumer/wiki/UsingOAuthConsumer

It looks like OAuthConsumer is a good choice at first glance. It is hosted with other OAuth libraries and has some nice documentation with it. I pulled down the code and it builds without errors but it does have many warnings. And when I run the new Build and Analyze feature in Xcode 3.2 I see 50 analyzer results. Many are marked as potential memory leaks which would likely lead to instability in any app which uses this library.

It seems there is no clear winner and I have to go with something before the big Twitter OAuth deadline.

Any suggestions?

like image 789
Brennan Avatar asked May 15 '10 02:05

Brennan


2 Answers

I've used bengottlieb's Twitter-OAuth without issues.

Build+Analyse finds only one issue (in SA_OAuthTwitterController.m) and that's just a variable that has a value stored during initialization that is never read. I've not seen any leaks in my use of it. It was simple to implement and so far (two apps in the store using it, a third in development) no problems at all.

like image 71
hjd Avatar answered Nov 05 '22 16:11

hjd


A new single-file solution is TDOAuth: http://github.com/tweetdeck/TDOAuth.

It's well-tested in that it is used in the TweetDeck iOS clients.

like image 2
mxcl Avatar answered Nov 05 '22 14:11

mxcl