Django application enabling registration through a variety of APIs
Project description
Django Social Registration enables developers to add alternative registration methods based on third party sites.
Requirements
django
oauth2
python-openid
Installation
Add the socialregistration directory to your PYTHON_PATH.
Add socialregistration to your INSTALLED_APPS settings of Django.
Add socialregistration.urls to your urls.py file.
Configuration
Facebook Connect
Add FACEBOOK_API_KEY and FACEBOOK_SECRET_KEY to your settings file representing the keys you were given by Facebook.
Add socialregistration.auth.FacebookAuth to AUTHENTICATION_BACKENDS in your settings file.
Add socialregistration.middleware.FacebookMiddleware to MIDDLEWARE_CLASSES in your settings file.
Add tags to your template file:
{% load facebook_tags %} {% facebook_button %} {% facebook_js %}
Add the following variables to your settings.py file with the values you were given by Twitter:
TWITTER_CONSUMER_KEY TWITTER_CONSUMER_SECRET_KEY TWITTER_REQUEST_TOKEN_URL TWITTER_ACCESS_TOKEN_URL TWITTER_AUTHORIZATION_URL
Add socialregistration.auth.TwitterAuth to your AUTHENTICATION_BACKENDS settings.
Add tags to your template file:
{% load twitter_tags %} {% twitter_button %}
Other OAuth Services
Please refer to the Twitter implementation of the signup / login process to extend your own application to act as a consumer of other OAuth providers. Basically it’s just plugging together some urls and creating an auth backend, a model and a view.
OpenID
Add socialregistration.auth.OpenIDAuth to AUTHENTICATION_BACKENDS in your settings.
Add tags to your template file:
{% load openid_tags %} {% openid_form %}
Logging users out
You can use the standard {% url auth_logout %} url to log users out of Django. Please note that this will not log users out of third party sites though. Logging out a Facebook user might look something like this:
<a href="#" onclick="javascript:FB.logout(function(response){ document.location = '{% url auth_logout %}' })">Logout</a>
To log users out of other third party sites, I recommend redirecting them further to the OAuth / OpenID providers after they logged out of your site.
HTTPS
If you wish everything to go through HTTPS, set SOCIALREGISTRATION_USE_HTTPS in your settings file to True.
Other Information
If you don’t wish your users to be redirected to the setup view to create a username but rather have a random username generated for them, set SOCIALREGISTRATION_GENERATE_USERNAME in your settings file to True.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-socialregistration-0.4.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3ad72994eea4f2ada81a308c5a8675bcfaa78baea469f8ac964709201d9e1c8 |
|
MD5 | c200bb23762b58d0c15e2035ef17a218 |
|
BLAKE2b-256 | eff38bbd10c745534046d036bb4a1f51b0c2fc66cdd62959a229ff6ef898f6c2 |