Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michaelbukachi/flask-authlib-client
A flask extension to help validate tokens from a different resource server.
https://github.com/michaelbukachi/flask-authlib-client
authlib flask
Last synced: about 1 month ago
JSON representation
A flask extension to help validate tokens from a different resource server.
- Host: GitHub
- URL: https://github.com/michaelbukachi/flask-authlib-client
- Owner: michaelbukachi
- Created: 2019-12-29T20:29:03.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-16T15:54:19.000Z (almost 5 years ago)
- Last Synced: 2024-11-16T09:48:55.478Z (about 2 months ago)
- Topics: authlib, flask
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flask-Authlib-Client
[![Build Status](https://travis-ci.org/michaelbukachi/flask-authlib-client.svg?branch=master)](https://travis-ci.org/michaelbukachi/flask-authlib-client)
Flask-Authlib-Client is a Flask extension that adds support for separate authorization/resource servers. It extends
authlib's flask integration. This extension is heavily inspired by
[django-oauth-toolkit](https://django-oauth-toolkit.readthedocs.io/en/latest/)### Install
```bash
$ pip install Flask-Authlib-Client
```### Usage
```python
from flask import Flask
from authlib.integrations.flask_client import OAuth
from flask_authlib_client import AuthClientclass Config:
# Other configurations
RESOURCE_SERVER_INTROSPECTION_URL = 'http://someurl'
RESOURCE_SERVER_INTROSPECTION_CREDENTIALS = ('test', 'test') # Client id and secret to authorization serverapp = Flask(__name__)
app.config.from_object(Config)
oauth = OAuth(app)
ac = AuthClient(app, oauth)# protect your endpoints
@app.route('/')
@ac.require_oauth()
def example():
return 'Ok'@app.route('/')
@ac.require_oauth('home') # Specify scope
def example():
return 'Ok'
```### Issues
Feel free to raise any issue [here](https://github.com/michaelbukachi/flask-authlib-client/issues).### Contributions
All contributions are welcome:smile:.