Skip to main content

A framework- and backend-independent social login provider.

Project description

Python Social Auth

A generic library to authenticate with login providers such as Twitter and Facebook.

$ pip install socialauth

Flask Example

def whoami():
    res = jwt.decode(request.cookies.get('jwt'), current_app.secret_key)
    return res.get('user_id')

def authenticate(provider):
    res = socialauth.http_get_provider(

    if res.get('status') == 302:
        resp = make_response(redirect(res.get('redirect')))
        if res.get('set_token_cookie') is not None:
            resp.set_cookie('jwt', res.get('set_token_cookie'))

        return resp

    if res.get('status') == 200:
        resp = make_response(jsonify({ 'status': 'success' }))
        resp.set_cookie('jwt', res.get('set_token_cookie'))
        return resp


Current Providers

  • Twitter
  • Facebook


Many social authentication solutions exist. I wanted something that didn’t have strong ties to an HTTP framework or storage backend. Preferably, I didn’t want something that dealt with a storage backend at all. This library uses JSON web tokens instead of sessions to deal with intermediate information in the OAuth flow (such as a token secret).

Project details

Download files

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

Files for socialauth, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size socialauth-0.1.0.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page