No project description provided
Project description
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.ClientSession
and bind to app likeasync_session
variable.Create session interface from
sanic-session
package and bind it to app likesession_interface
variable.Configure
app.config
settings. You should passOAUTH_PROVIDER, OAUTH_REDIRECT_URI, OAUTH_SCOPE
and another settings, for example,OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET
. Every setting withOAUTH
prefix will be passed to oauth provider construction.Apply blueprint
Add decorator
login_required
to 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.
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 Distributions
Built Distribution
Hashes for sanic_oauth-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abeb8ff14ad603452fce7f51507d92e687dd72636dd372c6501a9102c182d2ea |
|
MD5 | 94b3fb24f714233d2c1342632dcf3ca8 |
|
BLAKE2b-256 | 7338ee38cc612d6dea5f3a51be6ea34bf2c4a0c6e2ba9231a24690b84b10bf34 |