{"id":16509575,"url":"https://github.com/jtemporal/fastapi-and-auth0","last_synced_at":"2025-07-25T00:41:47.253Z","repository":{"id":61925055,"uuid":"398021977","full_name":"jtemporal/fastapi-and-auth0","owner":"jtemporal","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-03T21:39:21.000Z","size":6,"stargazers_count":23,"open_issues_count":1,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-27T13:17:44.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.youtube.com/watch?v=ZSzzpnsOdrA","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jtemporal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-19T17:22:43.000Z","updated_at":"2024-11-18T13:34:18.000Z","dependencies_parsed_at":"2022-10-23T16:45:24.630Z","dependency_job_id":null,"html_url":"https://github.com/jtemporal/fastapi-and-auth0","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtemporal%2Ffastapi-and-auth0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtemporal%2Ffastapi-and-auth0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtemporal%2Ffastapi-and-auth0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtemporal%2Ffastapi-and-auth0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtemporal","download_url":"https://codeload.github.com/jtemporal/fastapi-and-auth0/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234353765,"owners_count":18818878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T15:51:13.149Z","updated_at":"2025-01-18T01:55:23.813Z","avatar_url":"https://github.com/jtemporal.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Protecting your FastAPI API with Auth0\n\n## Running the example\n\nIn order to run the example you need to have `python3` (any version higher than `3.6`) and `pip3` installed, you'll also need an Auth0 account, [you can get your Auth0 account for free here](https://a0.to/jtemporal-signup-for-auth0).\n\n### Configuration\n\nThe configuration you'll need is mostly information from Auth0, you'll need both the tentant domain and the API information.\n\nThis app reads its configuration information from a `.config` file by default.\n\nTo create a `.config` file you can copy the `.example.config` file and fill the values accordingly:\n\n```console\ncp .example.config .config\n# update the config file for the correct values\nexport ENV='.config'\n```\n\nYou can change this behavior by setting the following environment variables (remember to update the values accordingly):\n\n```console\nexport ENV='variables'\nexport DOMAIN='your.domain.auth0.com'\nexport API_AUDIENCE='your.api.audience'\nexport ISSUER='https://your.domain.auth0.com'\nexport ALGORITHMS='RS256'\n```\n\n### Spin up the server\n\nOnce you've set your environment information below you'll find the commands you'll need.\n\n1. Create and activate a python environment:\n\n```console\npython3 -m venv .env\nsource .env/bin/bash\n```\n\n2. Install the needed dependencies with:\n\n```console\npip install -r requirements.txt\n```\n3. Start the server with the following:\n\n```console\nuvicorn application.main:app\n```\n\n4. Try calling [http://localhost:8000/api/public](http://localhost:8000/api/public)\n\n```\ncurl -X 'GET' \\\n  'http://localhost:8000/api/public' \\\n  -H 'accept: application/json'\n```\n\n## API documentation\n\nAccess [http://localhost:8000/docs](http://localhost:8000/docs). From there you'll see all endpoints and can test your API\n\n## Examples in this repo\n\n| Branch name | Example |\n| ----------- | ------- |\n| `main` | The starter sample only has two endpoints and one of them needs protection |\n| `private` | The result of protecting the first endpoint with Auth0 |\n| `private-scoped` | Implemented a protected endpoint with checks for scopes |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtemporal%2Ffastapi-and-auth0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtemporal%2Ffastapi-and-auth0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtemporal%2Ffastapi-and-auth0/lists"}