diff --git a/backend/druks/services/base.py b/backend/druks/services/base.py index fb6976be..3b61e903 100644 --- a/backend/druks/services/base.py +++ b/backend/druks/services/base.py @@ -33,6 +33,10 @@ def scopes(self) -> list[str]: def identity(self) -> dict[str, Any]: return self.row.identity + @property + def account_id(self) -> str: + return self.row.account_id + @property def connected_at(self): return self.row.connected_at diff --git a/backend/tests/test_services.py b/backend/tests/test_services.py index 7a558b2e..98a87acd 100644 --- a/backend/tests/test_services.py +++ b/backend/tests/test_services.py @@ -520,6 +520,7 @@ class Digest: assert [connection.id for connection in connections] == [row.id] assert connections[0].scopes == ["profile.read"] assert connections[0].identity == {"email": "night@acme.test"} + assert connections[0].account_id == SYSTEM_ACCOUNT_ID assert NightWatch.acme.get(row.id).id == row.id assert not NightWatch.acme.get("missing") diff --git a/docs/writing-an-extension.md b/docs/writing-an-extension.md index bf5352f1..13ac6e44 100644 --- a/docs/writing-an-extension.md +++ b/docs/writing-an-extension.md @@ -842,7 +842,8 @@ for connection in NightWatch.acme.list_for_account(account_id): `current_account_id.get()` in a route, the handler's argument in a subscriber. `NightWatch.acme.get(connection_id)` returns one connection when your own row stored its id. Each connection carries `id`, `scopes`, `identity` — the -provider's facts for the sign-in — and `connected_at`. The handle serves +provider's facts for the sign-in — `account_id` — the druks account that +signed it in — and `connected_at`. The handle serves live connections only. A revoked connection drops out of `get` and `list_for_account`, but its platform row survives with its owner and identity. Your rows never need tombstone copies of either.