Metadata-Version: 2.4
Name: mbgcard-auth-client
Version: 0.1.0
Summary: Python client for MBGCard auth-service (staff login, customer OTP, OIDC SSO).
Author: MBGCard
License: UNLICENSED
Project-URL: Homepage, https://github.com/Rajkoshta/service-delivery
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28

# mbgcard-auth-client (Python)

Thin Python client for **auth-service**. Works for both server-side use (staff
login in token mode) and building SSO redirects.

```bash
pip install mbgcard-auth-client
```

```python
from mbgcard_auth import AuthServiceClient

auth = AuthServiceClient("https://auth.mbgcard.com")

# OIDC SSO — get the URL to redirect the browser to
print(auth.start_login("https://yourapp.com/after")["authorizationUrl"])

# Staff login (server-side, token mode)
res = auth.staff_login("admin@mbgcard.com", "•••", token_mode=True)
print(res["token"], res["user"]["role"])
```

| Method | Endpoint |
|---|---|
| `start_login(redirect_uri)` | `POST /session/login/start` |
| `me()` | `GET /session/me` |
| `refresh()` / `logout()` | `POST /session/*` |
| `staff_login(email, pw, token_mode=False)` | `POST /staff/login` |

Errors raise `AuthServiceError(code, message, http_status)`.

Backend apps can also skip this client entirely and use standard OIDC
(`mozilla-django-oidc` / `authlib`) against the CRM provider — see the project's
`INTEGRATION.md`.

## Publish (maintainers)

```bash
pip install build twine
python -m build
python -m twine upload dist/*      # needs a PyPI account/token
```
