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):
Just install via pip:
pip install sanic_oauth
Note, that to use blueprint correctly, you need to additionally install sanic
and sanic-session
.
Simple way for use this is blueprint with oauth configuration.
But, before use it you need to:
aiohttp.ClientSession
and bind to app like async_session
variable.sanic-session
package and bind it to app like session_interface
variable.app.config
settings. You should pass OAUTH_PROVIDER, OAUTH_REDIRECT_URI, OAUTH_SCOPE
and another settings, for example, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET
. Every setting with OAUTH
prefix will be passed to oauth provider construction.login_required
to routes, that required oauth.You can see example for more details.
If you don't like current blueprint, you always can use providers directly and implements you own logic, like in old_example.