A framework- and backend-independent social login provider.
Project description
Flask Example
@app.route('/whoami')
def whoami():
res = jwt.decode(request.cookies.get('jwt'), current_app.secret_key)
return res.get('user_id')
@app.route('/auth/<provider>')
def authenticate(provider):
res = socialauth.http_get_provider(
provider,
request.base_url,
request.args,
current_app.secret_key,
request.cookies.get('jwt')
)
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
abort(400)
Current Providers
Twitter
Facebook
Why?
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
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
socialauth-0.1.0.tar.gz
(4.4 kB
view details)
File details
Details for the file
socialauth-0.1.0.tar.gz
.File metadata
File hashes
8d1d1b39d196e39a5bb8947a5a378f30a3a3513107c7d8e3ea0db9825621754c
e3bf699a1502c83bbfccf061ed152b66
ce15b79af8b3e845b16f3492642a147619d8c4b6364b2a6c27d1219cfbad7213
See more details on using hashes here.