Chapter 14. Social Networking

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.

14.1 Authenticating Users with OAUTH2

Ian Darwin

Problem

Most of the popular social networks use OAuth2 for authentication, so you will probably need to connect to it sometime.

Solution

There are many APIs available for OAuth2. Here’s a short list:

We’ll use the first of these in this recipe, and the third in Recipe 14.3.

Discussion

OAuth2 is the second version of the Open Authentication protocol, the core of many sites’ ...

Get Android Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.