Implementing Hybrid Auth Using Python

Now that we’ve looked at a hybrid OpenID OAuth implementation in PHP, let’s explore a similar implementation using Python.

In this example, we’ll take the OpenID example that we explored in Chapter 11 and modify it by introducing a request to fetch a preapproved request token when having the user authorize the application. We will then exchange this preapproved request token for an OAuth access token, which will allow us to make requests on the user’s behalf.

We’ll start this process by identifying the library dependencies we need to build out this project. Then we’ll proceed by jumping into the YAML file that we will use to load the example on Google App Engine, which will run our program.

Warning

If you are running this Yahoo! example in App Engine on localhost, you should be aware that if you create an application on Yahoo! (and numerous other services) to obtain the necessary OAuth keys, you may be required to verify your domain. This verification will fail on localhost and may prevent you from completing your application. You should deploy applications running within App Engine prior to executing so that your production environment can be verified.

Library dependencies

Before we begin this project, we need to define the libraries that we’ll use to complete the OAuth OpenID hybrid auth process.

OpenID ...

Get Programming Social Applications 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.