|
2 | 2 |
|
3 | 3 | This is the seed project you need to use if you're going to create an API using FastAPI in Python and Auth0. If you just want to create a Regular Python WebApp, please check [this project](https://github.com/auth0-samples/auth0-python-web-app/tree/master/01-Login) |
4 | 4 |
|
5 | | -<!-- |
6 | | -Please check our [Quickstart](https://auth0.com/docs/quickstart/backend/python) to better understand this sample. |
7 | | ---> |
8 | | - |
9 | 5 | ## Running the example |
10 | 6 |
|
11 | 7 | In order to run the example you need to have `python3` (any version higher than `3.6`) and `pip3` installed. |
12 | 8 |
|
13 | 9 | ### Configuration |
14 | 10 |
|
15 | | -This app is prepared to be deployed to a production environment which means you can create environment variables for running it both on production or development envs let's see how that looks. |
| 11 | +### Configuration |
16 | 12 |
|
17 | | -There are two ways you can configure and fill the necessary variables: |
| 13 | +The configuration you'll need is mostly information from Auth0, you'll need both the tentant domain and the API information. |
18 | 14 |
|
19 | | -1. Creating environment variables; or |
20 | | -1. Creating a `.config` file to hold said variables values |
| 15 | +This app reads its configuration information from a `.config` file by default. |
21 | 16 |
|
22 | | -For the **first** approach you'll need 4 variables (remember to update the values accordingly): |
| 17 | +To create a `.config` file you can copy the `.example.config` file and fill the values accordingly: |
23 | 18 |
|
24 | 19 | ```console |
25 | | -export DOMAIN='your.domain.auth0.com' |
26 | | -export API_AUDIENCE='your.api.audience' |
27 | | -export ALGORITHMS='RS256' |
28 | | -export ENV='variables' |
| 20 | +cp .example.config .config |
| 21 | +# update the config file for the correct values |
| 22 | +export ENV='.config' |
29 | 23 | ``` |
30 | 24 |
|
31 | | -For the **second** approach you can copy the `.example.config` file and fill the values accordingly: |
| 25 | +You can change this behavior by setting the following environment variables (remember to update the values accordingly): |
32 | 26 |
|
33 | 27 | ```console |
34 | | -cp .example.config .config |
35 | | -# update the config file for the correct values |
36 | | -export ENV='.config' |
| 28 | +export ENV='variables' |
| 29 | +export DOMAIN='your.domain.auth0.com' |
| 30 | +export API_AUDIENCE='your.api.audience' |
| 31 | +export ISSUER='https://your.domain.auth0.com' |
| 32 | +export ALGORITHMS='RS256' |
37 | 33 | ``` |
38 | 34 |
|
39 | 35 | ### Spin up the server |
@@ -93,13 +89,3 @@ curl -X 'GET' \ |
93 | 89 | -H 'accept: application/json' \ |
94 | 90 | -H 'Authorization: Bearer <FILL YOUR TOKEN WITH SCOPES HERE>' |
95 | 91 | ``` |
96 | | - |
97 | | -<!-- |
98 | | -## Running the example with Docker |
99 | | -
|
100 | | -In order to run the sample with [Docker](https://www.docker.com/) you need to add the `AUTH0_DOMAIN` and `API_ID` |
101 | | -to the `.env` filed as explained [previously](#running-the-example) and then |
102 | | -
|
103 | | -1. Execute in command line `sh exec.sh` to run the Docker in Linux, or `.\exec.ps1` to run the Docker in Windows. |
104 | | -2. Try calling [http://localhost:8000/api/public](http://localhost:8000/api/public) |
105 | | ---> |
0 commit comments