Metadata-Version: 2.4
Name: auth-backend
Version: 0.1.0
Summary: Reusable FastAPI authentication backend module
Author: Your Team
Author-email: team@yourcompany.com
Requires-Python: >=3.14,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: fastapi (>=0.115.0,<0.116.0)
Requires-Dist: httpx (>=0.28.0,<0.29.0)
Requires-Dist: passlib[bcrypt] (>=1.7.4,<2.0.0)
Requires-Dist: psycopg2-binary (>=2.9.10,<3.0.0)
Requires-Dist: pydantic (>=2.10.0,<3.0.0)
Requires-Dist: pydantic-settings (>=2.6.0,<3.0.0)
Requires-Dist: python-jose[cryptography] (>=3.3.0,<4.0.0)
Requires-Dist: python-multipart (>=0.0.20,<0.0.21)
Requires-Dist: sqlalchemy (>=2.0.36,<3.0.0)
Requires-Dist: uvicorn[standard] (>=0.32.0,<0.33.0)
Description-Content-Type: text/markdown

# Auth Backend Module

Reusable FastAPI authentication backend module with JWT tokens and OAuth support.

## Features

- ✅ Email/password registration and login
- ✅ Google OAuth integration
- ✅ JWT access and refresh tokens
- ✅ Token refresh with rotation
- ✅ Secure password hashing (bcrypt)
- ✅ PostgreSQL database with SQLAlchemy
- ✅ Token revocation on logout

## Installation

```bash
# Using Poetry
poetry add path/to/auth-backend

# Using pip
pip install -e path/to/auth-backend
```

## Usage

```python
from fastapi import FastAPI
from auth_backend import auth_router, init_db

app = FastAPI()

# Initialize database
init_db("postgresql://user:password@localhost/dbname")

# Include auth routes
app.include_router(auth_router, prefix="/auth", tags=["auth"])
```

## API Endpoints

- `POST /auth/register` - Register new user
- `POST /auth/login` - Login with email/password
- `POST /auth/google` - Login with Google OAuth
- `POST /auth/refresh` - Refresh access token
- `POST /auth/logout` - Logout (revoke refresh token)
- `GET /auth/me` - Get current user info

## Environment Variables

```env
DATABASE_URL=postgresql://user:password@localhost/dbname
SECRET_KEY=your-secret-key-here
```

## Database Models

- **User** - User accounts
- **RefreshToken** - JWT refresh tokens
- **OAuthAccount** - OAuth provider accounts

## Security Notes

⚠️ **Important**: Change the `SECRET_KEY` in `security.py` for production use!

