In the second decade of this century, nobody writing about the internet would underestimate the importance of social networking. Dominated as it is by a few major sites—Facebook and Twitter being the biggest of the big—social networking provides both an opportunity for developers and a missed opportunity for the developer community as a whole. Certainly there are still opportunities for creative use of social networking. But what is missing (despite valiant efforts) is a single “open social networking” API that includes authorization, messaging, and media interchange.
This chapter provides a few how-tos for accessing sites such as Facebook and Twitter, using plain HTTP (they all originated as web-based sites just before the explosion of mobile apps) and using more comprehensive (but more specific) APIs.
Most of the popular social networks use OAuth2 for authentication, so you will probably need to connect to it sometime.
There are many APIs available for OAuth2. Here’s a short list:
The Android code in the built-in
The Google Play Android code in the
GoogleAuthUtil class in the Google Play library
The open source android-oauth-client library
A commercial toolkit from Auth0
We’ll use the first of these in this recipe, and the third in Recipe 14.3.
OAuth2 is the second version of the Open Authentication protocol, the core of many sites’ user-authentication ...