O'Reilly logo

Programming Social Applications by Jonathan LeBlanc

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

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” ...

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