Metadata-Version: 2.4
Name: zisu-app-sdk
Version: 0.3.0
Summary: Python SDK for Zisu OIDC and embedded launch ticket login.
Author: Zisu
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.100; extra == "fastapi"
Requires-Dist: starlette>=0.27; extra == "fastapi"

# zisu-app-sdk

Python SDK for Zisu OIDC login and embedded iframe launch ticket login.

## Core usage

```python
from zisu_app_sdk import ZisuOIDCClient

client = ZisuOIDCClient(
    issuer="http://127.0.0.1:3005",
    client_id="essay-helper",
    client_secret="zisu-dev-secret",
    redirect_uri="http://127.0.0.1:8000/auth/zisu/callback",
)

auth = client.get_authorization_url()
print(auth.url)

result = client.exchange_launch_ticket(
    launch_ticket="...",
    expected_nonce="nonce-from-frame",
)
print(result.user.sub)
```

## FastAPI helper

```python
from fastapi import FastAPI
from zisu_app_sdk import ZisuFastAPIAuth, ZisuOIDCClient

app = FastAPI()
client = ZisuOIDCClient(
    issuer="http://127.0.0.1:3005",
    client_id="essay-helper",
    client_secret="zisu-dev-secret",
    redirect_uri="http://127.0.0.1:8000/auth/zisu/callback",
)

auth = ZisuFastAPIAuth(client, app_session_secret="change-me")
app.include_router(auth.router())
```

Set `cookie_secure=True` when the app is served over HTTPS.

Routes added by the helper:

- `GET /login/zisu`
- `GET /auth/zisu/callback`
- `POST /auth/zisu/embed`
- `GET /api/me`
