Adding Persona authentication to your django project

Persona is a decentralized login system made by Mozilla that aims to eliminate site-specific passwords so you can log in with your existing email accounts without having to type in a password.



Mozilla provides a library called django-browserid that integrates Persona authentication into Django, so you can simply added to to your requirements.txt or just install via pip :

$ sudo pip install django-browserid


Once done you need to follow the following steps :

Add django-browserid to your INSTALLED_APPS,

# ...
# ...

Add the django_browserid authentication backend :

# ...
'django.contrib.auth.backends.ModelBackend', # required for admin
# ...

Add the django_browserid context processor :

# ...
# ...

and finally you need to set your site url :


I have created a working demo project on github to play with, you can still check the docs or comment here if it doesn't work for you.

Mentioned on