Bootle authentication, for Personal, Google, Twitter and facebook.
Project description
Bottle plugin authentication, support with Google, Twitter and Facebook
Example
from bottle import Bottle, redirect, request, run
from bottle.ext import auth
from bottle.ext.auth.social.facebook import Facebook, UserDenied
from bottle.ext.auth.social.facebook import NegotiationError
from pprint import pformat
facebook = Facebook('fb-key', 'fb-secret',
'http://127.0.0.1:8000/callback', 'email')
app = Bottle()
plugin = auth.AuthPlugin(facebook)
app.install(plugin)
@app.route('/login')
def login(auth):
url = auth.redirect(request.environ)
redirect(url)
@app.route('/callback')
def callback(provider):
try:
user = auth.get_user(request.environ)
except UserDenied:
return 'User denied'
except NegotiationError:
return 'Negotiation error, maybe expired stuff'
return '<pre>{}</pre>'.format(pformat(user))
run(app=app, host='0.0.0.0', port='3333', debug=True)
Create project
Sign into your Google Apps account in your browser
Visit https://code.google.com/apis/console#access in the same browser
On the left menu, Create a new Project
To start, you don’t need any Services, so select the API Access tab rom the left menu and “Create an OAuth 2.0 client ID…”
Fill out the Client ID form for a web application and use localhost:8000 as your hostname
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
bottle-auth-0.1.2.tar.gz
(1.6 kB
view details)
File details
Details for the file bottle-auth-0.1.2.tar.gz
.
File metadata
- Download URL: bottle-auth-0.1.2.tar.gz
- Upload date:
- Size: 1.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52e7b8d3cab7498a4e0d61088bed2f6ed51b82bab86d86c74319b307509e69f3 |
|
MD5 | 7dd2a51d4885f359b65f0447622965a8 |
|
BLAKE2b-256 | d65e8a2826b3bd3828152b7c3186335e48c8c19f6fb021cbb3028d607b83dc81 |