Skip to content

About

No description, website, or topics provided.

Resources

Stars

52 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

FastAPI/Python: Starter API Code Sample

This Python code sample demonstrates how to build an API server using FastAPI that is secure by design.

Visit the "FastAPI/Python Code Samples: API Security in Action" section of the "Auth0 Developer Resources" to explore how you can secure FastAPI applications written in Python by implementing endpoint protection and authorization with Auth0.

Why Use Auth0?

Auth0 is a flexible drop-in solution to add authentication and authorization services to your applications. Your team and organization can avoid the cost, time, and risk that come with building your own solution to authenticate and authorize users. We offer tons of guidance and SDKs for you to get started and integrate Auth0 into your stack easily.

Set Up and Run the FastAPI Project

Run the Project

Requirements

Python 3.10 pip 22.2.2

Set up the Development Environment

Create a virtual environment under the root project directory:

macOS/Linux:

python3 -m venv venv

Windows:

py -3 -m venv venv

Then, activate the virtual environment:

macOS/Linux:

. venv/bin/activate

Windows:

venv\Scripts\activate

Install dependencies

pip install -r requirements.txt

Set up the environment variables

Create a .env file under the root project directory:

touch .env

Next, populate it with the following environment variables:

PORT=6060
CLIENT_ORIGIN_URL=http://localhost:4040
RELOAD=True

Run the api server

python3 application/main.py

About

No description, website, or topics provided.

Resources

Stars

52 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages