Skip to content

fix(desktop): deliver Windows OAuth deep links to the running app - #100

Draft
Aliferous3 wants to merge 12 commits into
mainfrom
fix/desktop-windows-deep-link-delivery
Draft

Aliferous3 wants to merge 12 commits into
mainfrom
fix/desktop-windows-deep-link-delivery

Conversation

@Aliferous3

@Aliferous3 Aliferous3 commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Evidence

The user completed GitHub OAuth and saw Chrome's Open Dev Ledger prompt, but the already-running Windows desktop app did nothing. Vercel logs also show a distinct second-attempt bad_verification_code server response. This PR addresses the native handoff, not GitHub's intermittent token rejection.

Root cause confirmed against Tauri documentation

Tauri 2 on Windows launches a second process for dev-ledger:// links. Its single-instance plugin must be registered first, and its deep-link feature enabled so the URL is automatically emitted to the original app. Previously, tauri-plugin-single-instance was added within .setup(), after tauri-plugin-deep-link, and the Cargo feature was missing. See https://v2.tauri.app/plugin/deep-linking/#desktop .

Fix

  • Enable tauri-plugin-single-instance's deep-link Cargo feature.
  • Register the plugin before opener, HTTP, deep-link, and .setup, while retaining the existing main-window focusing behavior.
  • No extra logging of URL parameters or credentials; the existing JS checks pending flow UUID + verifier, then exchanges the short-lived handoff code through hosted API.
  • Add regression tests guarding plugin ordering, registered scheme, and flow-bound JavaScript handoff.

Verify before release

  • Linux/macOS/Windows CI, and Windows Rust compile must pass.
  • Requires a new installer: this is a Rust binary change, not a server-only change.
  • Manually verify Windows installed app: prompt -> existing app window receives link -> POST /api/auth/desktop -> dashboard, with both remember modes. Do not claim full E2E success until tested.
  • Independent GitHub bad_verification_code remains under investigation in draft PR diagnostics(auth): investigate GitHub desktop code exchange rejections safely #99. No changes to GitHub config, server, auth secrets, or session endpoints here.

Draft only; do not merge without explicit approval.

Dependency-resolution follow-up

The first native CI compile exposed a conflict: tauri-plugin-single-instance@2.5.4 with its deep-link feature requires tauri-plugin-deep-link >=2.6.2, but the repository pinned =2.6.1 due to a Linux rust-ini@0.21.3 compile break in 2.6.2. Upstream deep-link@2.6.3 explicitly fixes that exact break (plugins-workspace#3711). Pinned the Rust plugin to =2.6.3 and updated src-tauri/Cargo.lock with the crate registry's published checksum and feature dependency. No JavaScript package update, unrelated dependency upgrades, or application UI changes. Revalidate all native targets on the final commit before approving a release.

November 1 investigation update

The Windows protocol probe brought the existing application window to the foreground (PID unchanged), proving OS registration and window activation work. Added a non-sensitive dev-ledger://diagnostic JavaScript receipt notice, persistent in-memory notice handoff to React, strict URI parsing, validation of unique flow/code parameters, and an explicit notice for unsolicited/mismatched desktop login returns. Duplicate native deliveries are ignored while an exchange is underway. No URLs, codes, tokens, flow IDs, or state values are logged. A manual installed-app test remains required after CI.

November 1 confirmed auth-lifetime defect

Production logs recorded desktop_exchange_completed (HTTP 200) at 2026-11-01 00:31:26 UTC; the database shows an unexpired desktop token created at 00:31:26.193 UTC. The installed diagnostic client displayed a mismatched-flow warning and remained on the login screen. The Remember unchecked path stores the bearer solely in module-scoped memoryToken, then calls window.location.reload(), discarding the token before /api/user can authenticate. This is a confirmed defect independent of duplicate callbacks.

The fix replaces reload with an onDesktopAuthCompleted callback triggering a React auth-generation refresh, so /api/user uses the token in the same webview. Remember checked still writes to OS keychain; unchecked still deletes any previous keychain entry; no web storage or cookies were introduced. Repeated delivery of a completed flow is ignored to prevent a spurious mismatch warning. Tests pin these contracts. A new installer is required; no backend deploy for this specific repair.

@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dev-ledger Ready Ready Preview Nov 1, 2026 12:34am UTC

This branch was successfully deployed

1 active deployment
Preview — 33ddd829 Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant