--- status: proposed date: 2026-11-28 ---
ADR 0024: KVT fork, Business Central cards through sleutels.kvt.nl
This record belongs to the KVT fork (KVT-FORK.md), not to upstream.
Context
KVT colleagues paste Business Central links (projects, work orders, contracts) into chats. Those links open the BC web client and show nothing in the chat itself. Mímir on sleutels.kvt.nl already reads BC with the reader's own rights. The app needs a personal credential for Mímir that is not the Teams or Graph token.
Options for the credential were: reuse the Teams/Graph token (wrong audience, and it would hand a Microsoft token to a KVT server), a shared API key (no per-user rights), or a personal app token from the shared KVT Login through a browser flow.
Options for where that browser flow runs were: the system browser (a second Microsoft sign-in) or the app's own session browser, which is already signed in to Microsoft (ADR 0003).
Options for the message format were: an own card format, or a plain link with readable text.
Decision
- The Login issues a personal, revocable app token (
sat_…, 90 days, scopesmimir.cards asclepius ponos daedalus) through RFC 8252: PKCE S256, a loopback redirect to127.0.0.1, a one-time code. The token sits in the OS keyring (servicerusty-teams.kvt-sleutels), never in SQLite or logs. - Connecting runs in a background tab of the session browser on Linux and macOS. The Login's Entra SSO then passes without asking. The app clicks «Koppelen» on the Login consent page, because the user already pressed «Connect» in Settings. When the page needs the user (account picker, MFA, password) or stalls, the app closes the tab and opens the same link in the system browser. Windows uses the system browser until the WebView2 host can open a plain tab.
- No Teams or Graph token goes to the Login or Mímir.
- A message keeps a plain HTML link with readable text (
Werkorder WO… - description). Official Teams shows a normal link; Rusty Teams shows up to three cards under the text. Details load only when the card is opened, with the reader's own token.
Consequences
- Others see nothing unusual (GUARDRAILS: no own message formats).
- While the background tab passes
login.microsoftonline.com, the session browser briefly reports a login page. The tab is closed after eight seconds on a Microsoft page, so a stuck sign-in cannot keep the Teams login window logic busy. - Chrome strings are English and German (ADR 0008); field labels and values come from Mímir in Dutch.
- A token stays valid until it expires or is revoked (Settings > Disconnect, or «Gekoppelde apps» on the Login). Nothing revokes it automatically when someone leaves.
Source
| 1 | --- |
| 2 | status: proposed |
| 3 | date: 2026-11-28 |
| 4 | --- |
| 5 | |
| 6 | # ADR 0024: KVT fork, Business Central cards through sleutels.kvt.nl |
| 7 | |
| 8 | This record belongs to the KVT fork (`KVT-FORK.md`), not to upstream. |
| 9 | |
| 10 | ## Context |
| 11 | |
| 12 | KVT colleagues paste Business Central links (projects, work orders, contracts) into chats. Those links open the BC web client and show nothing in the chat itself. Mímir on sleutels.kvt.nl already reads BC with the reader's own rights. The app needs a personal credential for Mímir that is not the Teams or Graph token. |
| 13 | |
| 14 | Options for the credential were: reuse the Teams/Graph token (wrong audience, and it would hand a Microsoft token to a KVT server), a shared API key (no per-user rights), or a personal app token from the shared KVT Login through a browser flow. |
| 15 | |
| 16 | Options for where that browser flow runs were: the system browser (a second Microsoft sign-in) or the app's own session browser, which is already signed in to Microsoft (ADR 0003). |
| 17 | |
| 18 | Options for the message format were: an own card format, or a plain link with readable text. |
| 19 | |
| 20 | ## Decision |
| 21 | |
| 22 | - The Login issues a personal, revocable app token (`sat_…`, 90 days, scopes `mimir.cards asclepius ponos daedalus`) through RFC 8252: PKCE S256, a loopback redirect to `127.0.0.1`, a one-time code. The token sits in the OS keyring (service `rusty-teams.kvt-sleutels`), never in SQLite or logs. |
| 23 | - Connecting runs in a background tab of the session browser on Linux and macOS. The Login's Entra SSO then passes without asking. The app clicks «Koppelen» on the Login consent page, because the user already pressed «Connect» in Settings. When the page needs the user (account picker, MFA, password) or stalls, the app closes the tab and opens the same link in the system browser. Windows uses the system browser until the WebView2 host can open a plain tab. |
| 24 | - No Teams or Graph token goes to the Login or Mímir. |
| 25 | - A message keeps a plain HTML link with readable text (`Werkorder WO… - description`). Official Teams shows a normal link; Rusty Teams shows up to three cards under the text. Details load only when the card is opened, with the reader's own token. |
| 26 | |
| 27 | ## Consequences |
| 28 | |
| 29 | - Others see nothing unusual (GUARDRAILS: no own message formats). |
| 30 | - While the background tab passes `login.microsoftonline.com`, the session browser briefly reports a login page. The tab is closed after eight seconds on a Microsoft page, so a stuck sign-in cannot keep the Teams login window logic busy. |
| 31 | - Chrome strings are English and German (ADR 0008); field labels and values come from Mímir in Dutch. |
| 32 | - A token stays valid until it expires or is revoked (Settings > Disconnect, or «Gekoppelde apps» on the Login). Nothing revokes it automatically when someone leaves. |