Using Mozilla Persona In Drupal 7

Mozilla Persona is a single sign on system that allows you to login into websites with a single registered email address. To register an email address head over to login.persona.org and sign up. Once signed up you can login to any website that offers Persona with your email address.

Short video explaining Mozilla Persona Beta 2.

The Mozilla Persona module for Drupal allows you to offer Persona as a login option for your users. You can configure the module to be the only sign in method or have it as a second option.

In this tutorial we’ll setup Persona to allow anonymous users to log in.

Getting Started

Before we can begin, download the Mozilla Persona module from drupal.org. There are no 3rd party libraries required, just download and install the module.

If you use Drush, run the following command:

$ drush dl persona
$ drush en persona

Setup Persona

Now that the module is installed, let’s setup Drupal to allow anonymous users to log in.

1. Open the settings.php file in the sites directory and add the following variable:

$conf['persona_audience'] = 'http://example.com:80';

Make sure you change http://example.com to your actual domain name. If you do not add the variable, then you will get a status report error.

Fig 1.1

Once you have added the variable to the settings.php file make sure you clear the site cache.

2. Go to Configuration -> “Account settings” and in the “Who can register accounts?” radio button list select Visitors.

Fig 1.2

This will allow users to login without being approved. If you want an administrator to approve each account, then leave “Visitors, but administrator approval is required” selected.

Login

Now that the basic setup of the module is done, you should be able to log in using Persona. If you haven’t already, you’ll have to create a Persona account.

1. To log in click on the sign in button, which should appear in the first sidebar region.

The button is displayed via the “Persona buttons” block. If you want to move the block to another region, then go to the Blocks page and assign it to another region.

Fig 1.3

You can also sign in via the general login page /user/login.

Fig 1.4

Configure Persona

Before we finish up, let’s check out the configuration page for Persona. You can access the page by going to Configuration -> “Persona settings”. From this page you can configure a few things like using Persona as the only sign in method, and use the user’s email address as their username.

Fig 1.7

Or you can change the look and feel of the “sign in” button.

Fig 1.6

And finally, you can add links to your “Privacy Policy” and “Terms Of Service” which will appear in the sign in dialog box.

Fig 1.5

If you have any questions, please leave a comment.

About The Author

3 thoughts on “Using Mozilla Persona In Drupal 7”

  1. Justin Geeslin

    This is great. I’ve been wanting to use Persona (and Open Badges) on a site I’m building. Can’t wait to try this out.

    1. Great Module Ivan and straight to the point.

      @Justin, you may be interested in the exploring the module that our team at Ebizon wrote – http://drupal.org/project/OpenBadging. We wanted to have our custom backpack so the module currently has OBI compliant badges with custom backpack. If we want to use Mozilla’s backpack, with some tweaking in the module, we can have Persona based login and mozilla’s backpack. That would make the module simpler.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top