New version of PlainOAuth, the example Twitter OAuth app for iPhone

Jun 25, 2010

In January, I released the no-bullshit Twitter-OAuth protocol writeup and the associated example app.

The project has been in need of an update for a long time. Back then, I didn't really know that well what I was doing, and I had yet to use the code in a real product. I've since used it in Crème and it's been fairly well battle-tested, but it also became apparent that the example needs to be restructured. I'm glad many people have found it useful as you can see from comments on those posts, and I've also gotten some questions about how to do some things that are unclear, such as GET requests. These are now much more clear in the example.

I just pushed the code to GitHub, just get it from the project page. Here is the change log:

  • Universal app. The app now works on iPhone and iPad, and supports both landscape and portrait modes. Getting the rotations and UI to work reasonably well took me longer than expected, but the end result seems to be quite approachable.

  • Embedded browser. The previous example took you out of the app and into Safari to get the PIN. While secure, this experience was sub-par. The new version uses an embedded UIWebView to load the PIN from Twitter.

  • Better designed reference login UI. The login UI is not a random hack anymore; it actually has some design and layout. I took the login UI from Crème and am hereby releasing it to public use. Feel free to use it in your own apps.

  • GET example. Doing GET with OAuth may be tricky and I got some questions about it, as you have to give OAuth the normalized URL and parameters separately, yet you merge them when constructing your actual HTTP request. This example should take away some confusion.

  • Refactored delegates. TwitterLoginPopup now uses two delegates: delegate for final authorization and canceling messages, and uiDelegate for progress feedback. The example app shows how to use these with a very simplistic activity indicator, but you can of course do something much more elaborate. You can see one example in Crème with a native-style transparent overlay.

Screenshot walkthrough of the new experience:

Screen shot 2010-06-24 at 22.55.34.png

Screen shot 2010-06-24 at 22.55.46.png

Screen shot 2010-06-24 at 22.55.50.png

Screen shot 2010-06-24 at 22.56.03.png

Screen shot 2010-06-24 at 22.56.10.png

Screen shot 2010-06-24 at 22.57.07.png