Flask APIs Sample using Axioms and axioms-flask-py. Secure your Flask APIs using Axioms authentication and authorization.
- Python 3.7+
- An Axioms client which can obtain access token after user's authentication and authorization and include obtained access token as bearer in
Authorization
header of all API request sent to Python/Flask application server.
Clone this repository,
git clone https://github.com/axioms-io/sample-python-flask.git
cd sample-python-flask
Create virtualenv,
python -m venv venv
Then activate virtualenv
and install requirements,
source venv/bin/activate
pip install -r requirements-dev.txt
Set environment variables,
export FLASK_APP=api.py
export FLASK_ENV=development
Create a .env
file and add following configs (see .sample-env
),
AXIOMS_DOMAIN=<your-axioms-slug>.axioms.io
AXIOMS_AUDIENCE=<your-axioms-resource-identifier>
flask run
Postman collection is included in this repository. Import the collection in your Postman, setup environment variables host
(i.e. localhost:5000) and access_token
(you can obtain from your client) and test these APIs.
See documentation for axioms-flask-py
.
You will need to provide Axioms domain and Axioms audience to complete deployment.