This is the seed project you need to use if you're going to create a Python + Flask API. If you just want to create a Regular Python WebApp, please check this project
Please check our Quickstart to better understand this sample.
In order to run the example you need to have python and pip installed.
You also need to set your Auth0 Domain and the API's audience as environment variables with the following names
respectively: AUTH0_DOMAIN and API_ID, which is the audience of your API. You can find an example in the
env.example file.
For that, if you just create a file named .env in the directory and set the values like the following,
the app will just work:
# .env file
AUTH0_DOMAIN=example.auth0.com
API_ID=YOUR_API_AUDIENCEOnce you've set those 2 enviroment variables:
- Install the needed dependencies with
pip install -r requirements.txt - Start the server with
python server.py - Try calling http://localhost:3010/ping
You can then try to do a GET to http://localhost:3010/secured/ping which will throw an error if you don't send an access token signed with RS256 with the appropriate issuer and audience in the Authorization header.
You can also try to do a GET to
http://localhost:3010/secured/private/ping which will throw an error if
you don't send an access token with the scope read:agenda signed with RS256 with the appropriate issuer and audience
in the Authorization header.
In order to run the sample with Docker you need to add the AUTH0_DOMAIN and API_ID
to the .env filed as explained previously and then
- Execute in command line
sh exec.shto run the Docker in Linux, or.\exec.ps1to run the Docker in Windows. - Try calling http://localhost:3010/ping