Skip to main content

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:

  1. Create aiohttp.ClientSession and bind to app like async_session variable.

  2. Create session interface from sanic-session package and bind it to app like session_interface variable.

  3. Configure 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.

  4. Apply blueprint

  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

sanic_oauth-0.4.0-py2.py3-none-any.whl (15.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sanic_oauth-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: sanic_oauth-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for sanic_oauth-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d1aedc8df17b627d5053cd320b86edb77936979b07b81d382c3915e220982f1b
MD5 ac9167504d3cfb7d57f2d6a531fbde67
BLAKE2b-256 dde13c714a897c2931232aab6a3caa7a22f4cdfe99badd3b1d4f1dea63ade1f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page