Metadata-Version: 2.4
Name: noauth
Version: 0.1.3
Summary: Centralized OAuth token service on Modal with encrypted storage and automatic refresh.
Author-email: Tomas Roda <dev@tomasroda.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/thehumanworks/noauth
Keywords: oauth,tokens,modal,fastapi,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.28.0
Requires-Dist: pydantic>=2.12.5
Provides-Extra: server
Requires-Dist: cryptography>=46.0.3; extra == "server"
Requires-Dist: fastapi>=0.128.0; extra == "server"
Requires-Dist: modal>=1.3.0.post1; extra == "server"
Provides-Extra: cli
Requires-Dist: typer>=0.15.0; extra == "cli"
Requires-Dist: rich>=13.0.0; extra == "cli"
Dynamic: license-file

# noauth

Centralized OAuth token service on Modal with encrypted storage and automatic refresh.

## SDK install (GitHub)

Use this when you only want the client library (no Modal server deps). This install does not pull Modal.

```bash
uv pip install "git+https://github.com/thehumanworks/noauth.git"
```

Minimal usage:

```python
from noauth.sdk import NoAuthClient

# Credentials can be provided via:
# 1. Explicit parameters (shown below)
# 2. Environment variables (NOAUTH_CLIENT_ID, NOAUTH_CLIENT_SECRET)
# 3. ~/.modal.toml file

client = NoAuthClient(
    base_url="https://<your-app>.modal.run",
    token_id="wk-...",
    token_secret="ws-...",
)
print(client.health().message)

# Store an OAuth credential
client.store_credential(
    "codex",
    "oauth",
    config={"client_id": "...", "token_url": "..."},
    tokens={"access_token": "...", "refresh_token": "..."},
)

# Get credentials
cred = client.get_credential("codex", "oauth")
print(cred.tokens.get("access_token"))

# List credentials
creds = client.list_credentials()
print([c.name for c in creds])

# Refresh OAuth tokens
client.refresh_credential("codex")

## CLI usage

```bash
# Health check
noauth health

# Get OAuth credential tokens
noauth get codex --kind oauth

# Get bearer credential value
noauth get api-key --kind bearer

# Store OAuth tokens (from JSON file)
noauth store codex ./tokens.json

# Store OAuth config + optional tokens
noauth store-credential codex --kind oauth --config ./config.json --tokens ./tokens.json

# Store bearer token
noauth store-credential api-key --kind bearer --value "secret"

# Refresh OAuth credential
noauth refresh codex

# List credentials
noauth list
noauth list --kind oauth

# Delete credential
noauth delete codex --kind oauth --force
```
```

## Server install (Modal app)

Use this when you want to deploy the service:

```bash
uv pip install "git+https://github.com/thehumanworks/noauth.git#egg=noauth[server]"
```

Deploy:

```bash
uv run modal deploy -m noauth.app
```

Notes:
- All endpoints require Modal Proxy Auth. Use a Proxy Auth token (`wk-...`/`ws-...`).
- API/CLI tokens (`ak-`/`as-`) are not valid for proxy auth.
