You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Adds support for Rexel authentication in two modes, plus the gateway
discovery/selection plumbing Rexel requires:
- **OAuth2 PKCE flow** — full interactive login for Rexel accounts
(`pyoverkiz/pkce.py`, `RexelAuthStrategy`).
- **Externally-managed tokens** — `RexelTokenCredentials` +
`RexelTokenAuthStrategy` let a host (e.g. Home Assistant) supply and
refresh tokens it manages itself.
- **Gateway discovery & selection** — Rexel exposes multiple gateways
via the enduser directory; the client now discovers candidates
(`GatewayCandidate`, `SupportsGatewaySelection`), auto-selects a sole
gateway at login, and injects the `gatewayId` header per request,
guarding requests made before selection (`NoGatewaySelectedError`).
### Breaking change
- `auth_headers` is now **async** across all auth strategies. See
`docs/migration-v2.md`.
### Docs
- Getting-started tab for the externally-managed token mode.
- Core-concepts note on the two Rexel auth modes.
- SDK reference renders the auth credentials module.
- Migration guide records the async `auth_headers` change.
## Test Plan
- [x] `pytest` — 488 passed (run in devcontainer)
- [ ] Verify interactive OAuth2 PKCE login against a real Rexel account
- [ ] Verify externally-managed token flow end-to-end from Home
Assistant
Copy file name to clipboardExpand all lines: docs/core-concepts.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,31 @@ States are name/value pairs that represent the current device status, such as cl
79
79
80
80
The API uses an event listener that you register once per session. Fetching events drains the server-side buffer. Events include execution state changes, device state updates, and other notifications.
81
81
82
+
## Authentication strategies
83
+
84
+
The library supports multiple authentication methods depending on the server:
85
+
86
+
-**Username/Password**: Most cloud servers (Somfy, Cozytouch, Hitachi, Nexity)
87
+
-**Bearer Token**: Cloud servers with pre-issued tokens
-**Optional Nexity dependencies** — `boto3` and `warrant-lite` are no longer installed by default. Install them with `pip install "pyoverkiz[nexity]"` if you use the Nexity server. A clear `ImportError` is raised at login time if the extra is missing.
414
+
415
+
## `auth_headers` is now async
416
+
417
+
`AuthStrategy.auth_headers()` and every concrete strategy's implementation are
418
+
now coroutines. This only affects code that calls `auth_headers()` directly or
419
+
implements a custom `AuthStrategy` — normal `OverkizClient` use is unaffected.
420
+
421
+
=== "Before"
422
+
423
+
```python
424
+
headers = strategy.auth_headers(path)
425
+
```
426
+
427
+
=== "After"
428
+
429
+
```python
430
+
headers = await strategy.auth_headers(path)
431
+
```
432
+
433
+
Custom strategies must change the method signature to `async def auth_headers`.
434
+
This change lets token-supplied strategies (such as Rexel's
435
+
`RexelTokenAuthStrategy`) await an externally-supplied access-token callback per
0 commit comments