Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

django sauth is an easy to setup social authentication/registration mechanism with support for several auth providers.

Project Description
SAUTH - Social Media Authentication Component


Sauth Provide the social media authentication and authorization for django applications.


OAuth 2.0 support depends on python-oauth2
Twiiter support depends on Twython
The backends(social media provider) demands the application registration on their corresponding website.

Dependency Package Installation

pip install twython or easy_install twython
pip install oauth2


from pypi

pip install django-sauth or easy_install django-sauth

from github , clone the project django-sauth


integrate sauth with django based applications

Install sauth in python path(virtualenv) and add the package in to installed apps

INSTALLED_APPS = ( ‘.................’,
Sauth providing two approach
Collect all the data from the provider and display into json format and you can easily process the data in to your needs , it will be good approach for Rest Api applications.
No need syncdb or migrate
Collect the data from the provider , store into the database and make sure user into Authenticated with the system.
Need syncdb or migrate(depend on django version)

Following second approach Add SauthAuthBackend in AUTHENTICATION_BACKENDS in

Add The SauthExceptionMiddleware in MIDDLEWARE_CLASSES


urlpatterns = patterns('',
url(r'^', include('sauth.urls')),

Authentication with Facebook

Create the application in facebook developer account[]

Add App id and Secrect key in

FACEBOOK_API_KEY = '*********************'
FACEBOOK_SECRET_KEY = '*****************************************'
SAUTH_REDIRECT_URL = 'http://localhost:8000/complete/'
[ Testing redirect url for google and linkedin is ‘’ ,
for production for all the provider please add the redirect url like this[ eg: / ]
SAUTH_FACEBOOK_SCOPE = [ ] # your choice, list format [ ‘scope1’,’scope2..’]
[ default : ['user_about_me','public_profile','email'] ]

SAUTH_FACEBOOK_EXTRA_FIELDS = [ ] #your choice , list format
[ default : ['id','first_name','last_name','email','gender'] ]

optional [ second approach ]
SAUTH_AFTER_AUTH_URL = '/login/complete'

SAUTH_LOGIN_ERROR_URL = 'sautherror' [ url name ]
[ default error will be shown by json format , if you need to get the errors in your views function you can add the url name here , you can easily get the error from session
status : request.session['error_status']
description : request.session['error_desc']
reason : request.session['error_reason']

Authentication with Linkedin
Create the Application in linkedin developer account[ ]

LINKEDIN_CLIENT_ID = '**************************'
LINKEDIN_SECRET_KEY = '******************************'
SAUTH_LINKEDIN_SCOPE = [ ] #your choice list format
[ default:['rw_company_admin','r_basicprofile','w_share','r_emailaddress'] ]
SAUTH_LINKEDIN_EXTRA_FIELDS = ( ‘l-filed1’ ,...,) # your choice in tuple format
[ default : (id,skills,first-name,last-name,positions:(company:(name)),formatted-name,date-of-birth,industry,email-address,location,headline,picture-urls::(original)) ]

Authentication with Twitter

Create the application with twitter developer account [ ]


Authentication with Google account

Create the application with google developer account :
[ ]

GOOGLE_KEY = “******************”
GOOGLE_SECRET_KEY = “ ************************* ”
SAUTH_GOOGLE_SCOPE = [ ‘scope1’,’..2’, ] # your choice in list field

[ default : ['plus.login', '', '', 'userinfo.profile'] ]

How to Use .


1) facebook
2) twitter
3) google
4) linkedin-oauth2

Authorization url is :

Release History

Release History

This version
History Node


Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting