Installation

Auth Middleware can be installed using various Python package managers. Choose the method that best fits your development workflow.

Requirements

  • Python: 3.10 or higher

  • FastAPI: 0.115.6 or higher (for FastAPI applications)

  • Starlette: Compatible with Starlette-based applications

Package Installation

Using pip (recommended):

pip install auth-middleware

Using UV (fastest):

uv add auth-middleware

Using Poetry:

poetry add auth-middleware

Using pipenv:

pipenv install auth-middleware

Provider-Specific Dependencies

Some authentication providers require additional dependencies:

AWS Cognito:

# All dependencies are included in the base package
pip install auth-middleware

Azure Entra ID:

# Additional Azure-specific packages may be needed
pip install auth-middleware

Google Identity:

# Additional Google-specific packages may be needed
pip install auth-middleware

Development Installation

If you want to contribute to the project or need the latest development version:

# Clone the repository
git clone https://github.com/impalah/auth-middleware.git
cd auth-middleware

# Install in development mode with UV
uv sync

# Or with pip
pip install -e .

Verification

Verify your installation by importing the package:

import auth_middleware
print(auth_middleware.__version__)

You should see the version number printed without any errors.

Docker Installation

For containerized applications, add auth-middleware to your requirements:

requirements.txt:

auth-middleware>=0.2.0
fastapi>=0.115.6
uvicorn>=0.35.0

Dockerfile example:

FROM python:3.12-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

Next Steps

After installation, continue with the User Guide to learn how to configure and use auth-middleware in your application.