oauthP5

A library by New York Times R&D Lab for the Processing programming environment.

Last update, 09/14/2012.

Allows Processing to access data from OAuth services such as Twitter, Facebook, Flickr, and OpenPaths; based on the excellent Scribe Java library by Pablo Fernandez.


OAuth is an open standard for authorization. It allows users to share their private data stored on one site with another site without having to hand out their credentials, typically supplying authentication tokens instead. Each token grants access to a specific site (e.g., Flickr) for specific resources (e.g., read-only access to an individual stream) and for a defined duration (e.g., the next 2 hours). This allows a user to grant a third party app (e.g. your Processing sketch) access to their information stored with another service provider, without sharing their access permissions or the full extent of their data.

OAuth is currently the preferred protocol for accessing user data on Twitter, Facebook, Google, Flickr, Foursquare, and OpenPaths, among many others. Wikipedia has a a list here.

For usage feedback on the oauthP5 library, please post to the Processing's contributed library forum. For bugs reports, and feature requests, please post to our Bitbucket issue tracker.

Download

Download oauthP5 version (0.1.1) in .zip format.

Installation

Unzip and put the extracted oauthP5 folder into the libraries folder of your Processing sketches. Reference and examples are included in the oauthP5 folder.

Keywords. oauth, security, protocol, http, data

Reference. Have a look at the javadoc reference here. A copy of the reference is included in the .zip as well.

Source. The source code of oauthP5 is available at Bitbucket, and its repository can be browsed here.

Examples

Find a list of examples in the current distribution of oauthP5, or have a look at them by following the links below.

Tested

Platform osx
Processing 1.5.x, 2.0a6
Dependencies none

Images

More on OAuth

We're very excited about the emergence of OAuth as a standard for secure data access, and hopefully, by using this library, you will too! At the same time, we understand that the OAuth concept is totally confusing because it took us a while to get it too. However, the OAuth Community Site has this excellent analogy:

Many luxury cars today come with a valet key. It is a special key you give the parking attendant and unlike your regular key, will not allow the car to drive more than a mile or two. Some valet keys will not open the trunk, while others will block access to your onboard cell phone address book. Regardless of what restrictions the valet key imposes, the idea is very clever. You give someone limited access to your car with a special key, while using your regular key to unlock everything.

Every day new websites launch offering services which tie together functionality from other sites. A photo lab printing your online photos, a social network using your address book to look for friends, and APIs to build your own desktop application version of a popular site. These are all great services – what is not so great about some of the implementations is their request for your username and password to the other site. When you agree to share your secret credentials, not only you expose your password to someone else (yes, that same password you also use for online banking), you also give them full access to do as they wish. They can do anything they wanted – even change your password and lock you out.

This is the problem OAuth solves. It allows you, the User, to grant access to your private resources on one site (which is called the Service Provider), to another site (called Consumer, not to be confused with you, the User). While OpenID is all about using a single identity to sign into many sites, OAuth is about giving access to your stuff without sharing your identity at all (or its secret parts).

Read more about OAuth here.

Additional API Support

So, you are looking to connect to services other than Twitter, Facebook, Google, Flickr, and OpenPaths. We are planning to expand the variety of examples we offer in the future, but meanwhile you need not worry about waiting either — the Scribe Java OAuth library supports almost 30 services as of last count, and since oauthP5 is really just a Processing-flavored version of Scribe, you can easily use any of those APIs with just a little Java-to-Processing translation.

The Scribe library comes with 24 Java examples, which you can peruse here and adopt for your own purposes. If the API you wish to use isn't in that list, study the Scribe source code to see all supported APIs. You will find that nearly all of the APIs operate in the same way and solutions should be very similar to existing oauthP5 libraries. If you have successful and well-documented examples of new APIs and you are interested in contributing them to oauthP5, let us know.