Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/druks/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions backend/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
3 changes: 2 additions & 1 deletion docs/writing-an-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down