Implementing OpenID Using Python

We’ve explored the OpenID implementation using PHP as the backing server-side language, so now let’s see what shape the implementation takes when Python is used as the main delivery language. We will cover the same type of implementation as before—one that gives us a program that can perform discovery on a number of different OpenID providers and allow the user to sign in using their services. We will also integrate our same three OpenID extensions to provide additional security and user information during the process:

  • Simple Registration for basic user information

  • Attribute Exchange for more extensive user information

  • PAPE for additional security levels

At the end of the example, we will have a complete end-to-end program that allows users to log in using a range of OpenID providers.

Getting the required OpenID library

For this example, we are using the Janrain OpenID Python library, which you can find in Janrain’s list of libraries at http://www.janrain.com/openid-enabled. Before we begin implementing the code for this example, we first need to install the OpenID library.

Note

Before running the python setup.py install command to install the OpenID library, you will need to have the distutils module installed. This is part of the Python standard library, but some distributions package it separately in a “python-dev” ...

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.