idip: idss-idp device-code approval UI (Netbird CLI) #795

Closed
opened 2026-08-25 09:13:01 +00:00 by matou-build-agent · 3 comments

Follow-up from #776 (ADR 0199's Netbird row). The bridge SERVES the OAuth 2.0 device-authorization grant — the endpoint is live and discovery advertises urn:ietf:params:oauth:grant-type:device_code (internal/idp/device.go implements op.DeviceAuthorizationStorage, seam-asserted in #776). What is NOT yet built is the interactive user-code approval page: a member enters the code Netbird's CLI shows, signs in (the same KERI step as /login), and store.CompleteDeviceAuthorization marks the flow done.

This rides the same faked-KERI-browser join point as the login page, so it lands with the member-browser bundle at the idip-e2e-drive. Authorization-code + PKCE (Netbird's dashboard) already completes end-to-end in #776; this closes the CLI (netbird up) device flow.

Follow-up from #776 (ADR 0199's Netbird row). The bridge SERVES the OAuth 2.0 device-authorization grant — the endpoint is live and discovery advertises `urn:ietf:params:oauth:grant-type:device_code` (`internal/idp/device.go` implements `op.DeviceAuthorizationStorage`, seam-asserted in #776). What is NOT yet built is the interactive **user-code approval page**: a member enters the code Netbird's CLI shows, signs in (the same KERI step as `/login`), and `store.CompleteDeviceAuthorization` marks the flow done. This rides the same faked-KERI-browser join point as the login page, so it lands with the member-browser bundle at the idip-e2e-drive. Authorization-code + PKCE (Netbird's dashboard) already completes end-to-end in #776; this closes the CLI (`netbird up`) device flow.
Author
Member

This was generated by AI during triage.

Missing-design gate check: this ticket names no docs/ux/flows/*.mermaid or docs/ux/wireframes/*.html file, and none exists for this surface. That's not an oversight — DDR 0200 explicitly named the bridge's branded sign-in page (the same join point this device-code approval page rides) as a member-facing surface "deliberately not wireframed" at the design-tier gate, owed only brand-kit-fidelity at build time, and it shipped that way in #776. This ticket's own text confirms it rides that exact precedent ("the same faked-KERI-browser join point as the login page"). So needs-design does not apply here — routing to ready-for-agent.

Verified against the current code: internal/idp's device-authorization storage (CompleteDeviceAuthorization) is implemented and referenced by a comment describing the not-yet-built approval page as its caller — the server side is ready and waiting on exactly this UI. Two-way door — new UI code plus reuse of an existing sign-in component, revertible by commit, provable at the idip-e2e-drive seam — proceeding.

Agent Brief

Category: enhancement
Summary: Build the interactive user-code approval page for the OAuth 2.0 device-authorization grant, so a member can approve a Netbird CLI (netbird up) device join from a browser.

Current behavior:
The bridge already serves the device-authorization grant end-to-end at the protocol level — discovery advertises it, and the storage layer's completion call exists and is implemented. What's missing is the page a member is sent to: entering the short user code the CLI displayed, signing in (the same KERI-challenge flow the standard sign-in page already uses), and triggering the completion call.

Desired behavior:
A member running netbird up sees a user code and a URL. Visiting that URL, they're prompted to enter (or confirm, if pre-filled from the URL) the code, sign in via the existing KERI sign-in step, and approve. On approval, the flow completes and the CLI proceeds. An expired or already-consumed code is rejected with an honest message, not a silent failure.

Key interfaces:

  • Reuses the same sign-in component/flow as the bridge's standard browser sign-in page (the KERI challenge/response step) — don't build a second sign-in implementation.
  • Calls the storage layer's device-authorization completion method once sign-in succeeds and the code is confirmed valid.
  • Follows the brand-kit fidelity rules already established for the bridge's sign-in page (DDR 0200) — same visual/brand contract, no new wireframe needed.

Acceptance criteria:

  • A member can complete the CLI (netbird up) device-authorization flow entirely through this page: enter code, sign in, approve.
  • An expired or invalid user code produces an honest rejection message, not a crash or silent no-op.
  • A code that's already been consumed cannot be approved a second time.
  • This is verified at the idip-e2e-drive seam (per ADR 0183's driver contract — verdict plus eyeballed screenshots), alongside the existing authorization-code + PKCE flow it sits beside.

Out of scope:

  • The authorization-code + PKCE flow (Netbird's dashboard) — already complete in #776.
  • Any change to the device-authorization protocol endpoint itself (internal/idp/device.go) — this is the approval UI only.
  • A standalone wireframe file — per DDR 0200's ruling, this surface is brand-kit-fidelity at build time, not pre-wireframed.
> *This was generated by AI during triage.* **Missing-design gate check:** this ticket names no `docs/ux/flows/*.mermaid` or `docs/ux/wireframes/*.html` file, and none exists for this surface. That's not an oversight — DDR 0200 explicitly named the bridge's branded sign-in page (the same join point this device-code approval page rides) as a member-facing surface **"deliberately not wireframed"** at the design-tier gate, owed only brand-kit-fidelity at build time, and it shipped that way in #776. This ticket's own text confirms it rides that exact precedent ("the same faked-KERI-browser join point as the login page"). So `needs-design` does not apply here — routing to `ready-for-agent`. Verified against the current code: `internal/idp`'s device-authorization storage (`CompleteDeviceAuthorization`) is implemented and referenced by a comment describing the not-yet-built approval page as its caller — the server side is ready and waiting on exactly this UI. Two-way door — new UI code plus reuse of an existing sign-in component, revertible by commit, provable at the idip-e2e-drive seam — proceeding. ## Agent Brief **Category:** enhancement **Summary:** Build the interactive user-code approval page for the OAuth 2.0 device-authorization grant, so a member can approve a Netbird CLI (`netbird up`) device join from a browser. **Current behavior:** The bridge already serves the device-authorization grant end-to-end at the protocol level — discovery advertises it, and the storage layer's completion call exists and is implemented. What's missing is the page a member is sent to: entering the short user code the CLI displayed, signing in (the same KERI-challenge flow the standard sign-in page already uses), and triggering the completion call. **Desired behavior:** A member running `netbird up` sees a user code and a URL. Visiting that URL, they're prompted to enter (or confirm, if pre-filled from the URL) the code, sign in via the existing KERI sign-in step, and approve. On approval, the flow completes and the CLI proceeds. An expired or already-consumed code is rejected with an honest message, not a silent failure. **Key interfaces:** - Reuses the same sign-in component/flow as the bridge's standard browser sign-in page (the KERI challenge/response step) — don't build a second sign-in implementation. - Calls the storage layer's device-authorization completion method once sign-in succeeds and the code is confirmed valid. - Follows the brand-kit fidelity rules already established for the bridge's sign-in page (DDR 0200) — same visual/brand contract, no new wireframe needed. **Acceptance criteria:** - [ ] A member can complete the CLI (`netbird up`) device-authorization flow entirely through this page: enter code, sign in, approve. - [ ] An expired or invalid user code produces an honest rejection message, not a crash or silent no-op. - [ ] A code that's already been consumed cannot be approved a second time. - [ ] This is verified at the idip-e2e-drive seam (per ADR 0183's driver contract — verdict plus eyeballed screenshots), alongside the existing authorization-code + PKCE flow it sits beside. **Out of scope:** - The authorization-code + PKCE flow (Netbird's dashboard) — already complete in #776. - Any change to the device-authorization protocol endpoint itself (`internal/idp/device.go`) — this is the approval UI only. - A standalone wireframe file — per DDR 0200's ruling, this surface is brand-kit-fidelity at build time, not pre-wireframed.
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=10104
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=10104 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #795 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 795,
  "status": "success",
  "commits": [
    "2bda2096646710904262ef406436ee01035a1238"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/idp/deviceapprove.go",
    "internal/idp/deviceapprove_test.go",
    "internal/idp/provider.go",
    "internal/idp/seam_test.go",
    "internal/idp/signin.go",
    "internal/idp/storage.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/idp/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go vet ./internal/idp/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c gofmt -l internal/idp/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A member can complete the CLI (netbird up) device-authorization flow entirely through this page: enter code, sign in, approve": "TestSeam_Device_ApprovalCompletesFlow (internal/idp/seam_test.go): device_authorization -> pending poll -> GET /device prefilled form -> POST /device/verify (KERI) -> poll mints id_token with sub=AID + groups. Handler internal/idp/deviceapprove.go; page renders data-field user-code/recovery-phrase + data-action approve-device.",
    "An expired or invalid user code produces an honest rejection message, not a crash or silent no-op": "Invalid: TestSeam_Device_InvalidCode_Rejected asserts honest 'waiting on' message, no approval. Expired: TestApproveDevice_Guards (deviceapprove_test.go, injectable clock) asserts errDeviceCodeExpired. store.checkUserCode/approveDevice guard in deviceapprove.go.",
    "A code that's already been consumed cannot be approved a second time": "TestSeam_Device_ApprovalCompletesFlow second approval refused with 'already been approved'; TestApproveDevice_Guards asserts errDeviceCodeConsumed. approveDevice sets state.Done under the lock and userCodeGuard refuses a Done code.",
    "This is verified at the idip-e2e-drive seam (per ADR 0183) alongside the existing authorization-code + PKCE flow": "Verified at the OIDC-over-HTTP seam (seam_test.go, the same seam #776's auth-code+PKCE tests use); the faked-KERI-browser bundle + screenshots join at the idip-e2e-drive per the slice-map ruling and the ticket text."
  },
  "summary": "Built the brand-worn device-code approval page (GET /device + POST /device/verify) reusing the KERI sign-in, guarding unknown/expired/consumed codes and minting device-grant tokens with the verified identity.",
  "blockers": []
}
**close-report** for #795 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 795, "status": "success", "commits": [ "2bda2096646710904262ef406436ee01035a1238" ], "changed_files": [ "STATUS.md", "internal/idp/deviceapprove.go", "internal/idp/deviceapprove_test.go", "internal/idp/provider.go", "internal/idp/seam_test.go", "internal/idp/signin.go", "internal/idp/storage.go" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/idp/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go vet ./internal/idp/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c gofmt -l internal/idp/", "exit_code": 0 } ], "criteria": { "A member can complete the CLI (netbird up) device-authorization flow entirely through this page: enter code, sign in, approve": "TestSeam_Device_ApprovalCompletesFlow (internal/idp/seam_test.go): device_authorization -> pending poll -> GET /device prefilled form -> POST /device/verify (KERI) -> poll mints id_token with sub=AID + groups. Handler internal/idp/deviceapprove.go; page renders data-field user-code/recovery-phrase + data-action approve-device.", "An expired or invalid user code produces an honest rejection message, not a crash or silent no-op": "Invalid: TestSeam_Device_InvalidCode_Rejected asserts honest 'waiting on' message, no approval. Expired: TestApproveDevice_Guards (deviceapprove_test.go, injectable clock) asserts errDeviceCodeExpired. store.checkUserCode/approveDevice guard in deviceapprove.go.", "A code that's already been consumed cannot be approved a second time": "TestSeam_Device_ApprovalCompletesFlow second approval refused with 'already been approved'; TestApproveDevice_Guards asserts errDeviceCodeConsumed. approveDevice sets state.Done under the lock and userCodeGuard refuses a Done code.", "This is verified at the idip-e2e-drive seam (per ADR 0183) alongside the existing authorization-code + PKCE flow": "Verified at the OIDC-over-HTTP seam (seam_test.go, the same seam #776's auth-code+PKCE tests use); the faked-KERI-browser bundle + screenshots join at the idip-e2e-drive per the slice-map ruling and the ticket text." }, "summary": "Built the brand-worn device-code approval page (GET /device + POST /device/verify) reusing the KERI sign-in, guarding unknown/expired/consumed codes and minting device-grant tokens with the verified identity.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#795
No description provided.