So how do you actually go about integrating features from these services into your application? First the needs to allow your application access to their profile, and this bring us to Open Authorization – better known as OAuth.

OAuth you say?!

OAuth is an open standard for authorization used by tons of popular services, foursquare, Twitter, and Tumblr, to name a few. It allows applications to connect their users to these services without having to handle their username and password.

There are a couple versions of OAuth which we have created sample apps for.

OAuth 1

Let’s be honest, OAuth 1 can be darn right nasty to work with out-of-the-box. OAuth 1 and I are not really good friends, we’ve had many fights over the past year, and often I’ve been on the losing side. In a nutshell, the way OAuth 1 works is by having an application perform a series of requests to a service, exchanging “tokens”, and ultimately granting the application access to the service on behalf of the user. It requires several things to go just right, and if something doesn’t, access is denied.

Luckily there is a really awesome open-source JavaScript library written by Rob Griffiths (@bytespider) called jsOAuth. JsOAuth takes the pain and extensive process of OAuth 1 away, and allows you to focus on connecting your app with a service such as Twitter rather than spend a ton of time working with the OAuth 1 protocol.

OAuth 2

While OAuth 1 is my adversary; OAuth 2 is my best friend. This is the next evolution of the OAuth protocol and is used by services like foursquare, and Facebook. OAuth 2 is much friendlier for developers to integrate into their apps, and provides much easier, and straight forward authorization “flows” to work with. Though the standard is still evolving, it’s solid, and in contrast to OAuth 1, is amazingly easy to work with.

The Sample Apps

Getting started with OAuth can be pretty intimidating to say the least. As a former 3rd party developer, I’ve been there. I’ve screamed at my console log, cried like a baby, and even begged the OAuth gods for it to “just work”. Since joining the BlackBerry® Developer Relations team here at RIM®, I vowed to help make this process easier for fellow developers and I’m glad to finally say that we’ve released two sample apps on GitHub today to help guide you on your OAuth journey.

The first sample app shows how to integrate Twitter into your application by using the OAuth 1 protocol. You’ll learn how to quickly and painlessly authenticate with Twitter, and post a Tweet to a user’s timeline by taking advantage of the jsOAuth library.

The second sample shows integration with foursquare, and uses OAuth 2. It’ll show you how your application can authenticate a user with the service, search for near-by venues, and then check-in to a venue.

The third sample shows how to integrate Facebook and OAuth 2 into your application. You’ll learn how to authenticate a user with Facebook, and interact with their feed by posting, and reading content.

Each of these samples are completely Open Source, and available on GitHub. If you find them useful, have any feedback, or need an extra helping hand along your way find me on the BlackBerry Developer Support Forums or Twitter @chadtatro.