Simple OAuth library to work with sanic. Basically, just rewrited version of aioauth_client with async/await syntax and some optimization. Can be used only with python 3.5/3.6.
Available providers (in alphabetic order):
Amazon
BitBucket
BitBucket v2
Discord (thanks to @smlbiobot)
Eventbrite
Facebook
Flickr
Foursquare
Github
GitLab
Google
LinkedIn
Meetup
ok.ru
Pinterest
Plurk
Tumblr
Twitter
Vimeo
vk.com
Yahoo
Yandex
Requirements
python >= 3.6
Installation
Just install via pip:
pip install sanic_oauth
Note, that to use blueprint correctly, you need to additionally install sanic and sanic-session.
Usage
Simple way for use this is blueprint with oauth configuration.
But, before use it you need to:
Create
aiohttp.ClientSessionand bind to app likeasync_sessionvariable.Create session interface from
sanic-sessionpackage and bind it to app likesession_interfacevariable.Configure
app.configsettings. You should passOAUTH_PROVIDER, OAUTH_REDIRECT_URI, OAUTH_SCOPEand another settings, for example,OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET. Every setting withOAUTHprefix will be passed to oauth provider construction.Apply blueprint
Add decorator
login_requiredto routes, that required oauth.
You can see example for more details.
Advanced usage
If you don’t like current blueprint, you always can use providers directly and implements you own logic, like in old_example.
Release files for sanic-oauth 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sanic_oauth-0.4.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Release files / sanic_oauth-0.4.0-py2.py3-none-any.whl
| Download URL | sanic_oauth-0.4.0-py2.py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d1aedc8df17b627d5053cd320b86edb77936979b07b81d382c3915e220982f1b
|
|
BLAKE2b-256 checksum How to use checksums |
dde13c714a897c2931232aab6a3caa7a22f4cdfe99badd3b1d4f1dea63ade1f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|