O'Reilly logo

Android Cookbook, 2nd Edition by Ian F. Darwin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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’ user-authentication ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required