Setup ===== Installation ------------ You can use pip to install django-browserid and requirements: pip install django-browserid Configuration ------------- To use ``django-browserid``, you'll need to make a few changes to your ``settings.py`` file:: # Add 'django_browserid' to INSTALLED_APPS. INSTALLED_APPS = ( # ... 'django.contrib.auth', 'django_browserid', # Load after auth # ... ) # Add the django_browserid authentication backend. AUTHENTICATION_BACKENDS = ( # ... 'django_browserid.auth.BrowserIDBackend', # ... ) # Add the django_browserid context processor. TEMPLATE_CONTEXT_PROCESSORS = ( # ... 'django_browserid.context_processors.browserid', # ... ) .. note:: BrowserID uses an assertion and an audience to verify the user. This ``SITE_URL`` is used to determine the audience. For security reasons, it is *very important* that you set ``SITE_URL`` correctly. .. note:: ``TEMPLATE_CONTEXT_PROCESSORS`` is not in the settings file by default. You can find the default value in the `Context Processor documentation`_. Next, edit your ``urls.py`` file and add the following:: urlpatterns = patterns('', # ... (r'^browserid/', include('django_browserid.urls')), # ... ) You can also set the following optional settings in ``settings.py``:: # Path to redirect to on successful login. LOGIN_REDIRECT_URL = '/' # Path to redirect to on unsuccessful login attempt. LOGIN_REDIRECT_URL_FAILURE = '/' # Path to redirect to on logout. LOGOUT_REDIRECT_URL = '/' Finally, you'll need to add the login button to your templates. There are three things you will need to add to your templates: 1. ``{% browserid_info %}``: Outputs an invisible element that stores info about the current user. Must be within the ``
`` tag and appear only **once**. 2. ``{% browserid_js %}``: Outputs the `` {% browserid_js %}