Skip to main content

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 oauth python-openid pyfacebook

Installation

  1. Add the socialregistration directory to your PYTHON_PATH.

  2. Add socialregistration to your INSTALLED_APPS settings of Django.

  3. Add socialregistration.urls to your urls.py file.

Configuration

Facebook Connect

  1. Add FACEBOOK_API_KEY and FACEBOOK_SECRET_KEY to your settings file representing the keys you were given by Facebook.

  2. Add socialregistration.auth.FacebookAuth to AUTHENTICATION_BACKENDS in your settings file.

  3. Add ‘facebook.djangofb.FacebookMiddleware’ to MIDDLEWARE_CLASSES in your settings file. See: http://wiki.developers.facebook.com/index.php/User:PyFacebook_Tutorial#Add_the_middleware

  4. Add tags to your template file:

    {% load facebook_tags %}
    {% facebook_button %}
    {% facebook_js %}
  5. If you wish on using the pyfacebook library to do API calls instead of the JavaScript lib, add socialregistration.middleware.FacebookMiddleware to MIDDLEWARE_CLASSES

Twitter

  1. 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
  2. Add socialregistration.auth.TwitterAuth to AUTHENTICATION_BACKENDS in your settings file.

  3. Add tags to your template file:

    {% load twitter_tags %}
    {% twitter_button %}

Other OAuth Services

There is an example of how FriendFeed integration could work. socialregistration.models provides a FriendFeedProfile model to save account data, socialregistration.auth provides examples for different auth backends for different service providers, socialregistration.utils provides a Twitter and FriendFeed interface and socialregistration.urls provides examples based on Twitter and FriendFeed how to hook in more OAuth based services.

OpenID

  1. Add socialregistration.auth.OpenIDAuth to AUTHENTICATION_BACKENDS in your settings file.

  2. 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. When using Facebook Connect, it is recommended to follow the FBConnect developer wiki. See: http://wiki.developers.facebook.com/index.php/Connect/Authorization_Websites#Logging_Out_Users

<a href="#" onclick="FB.Connect.logoutAndRedirect('{% url auth_logout %}')">Logout</a>

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 username generated for them, set SOCIALREGISTRATION_GENERATE_USERNAME in your settings file to True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-socialregistration-0.2.tar.gz (12.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page