Skip to content

feat: one-click GitHub sign-in via OAuth device flow - #10

Merged
jamubc merged 1 commit into
mainfrom
feat/oauth-device-flow
Jun 15, 2026
Merged

feat: one-click GitHub sign-in via OAuth device flow#10
jamubc merged 1 commit into
mainfrom
feat/oauth-device-flow

Conversation

@jamubc

@jamubc jamubc commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Why

Onboarding offered the gh CLI and a pasted PAT, but the headline "Sign in with GitHub" button was a disabled placeholder because no OAuth App client id existed. The device-flow code was already implemented in core; this turns it on for a true one-click sign-in.

What Changes

  • Set the registered OAuth App client id in credential::device_flow::CLIENT_ID.
  • Add a connect_via_oauth command that starts the device flow, returns the user code and verification URL, and polls on a background thread to finish the connect or emit oauth:error.
  • Enable the onboarding button: it shows the user code, opens github.com/login/device, and completes when the user authorizes.

ADDED Requirements

Requirement: One-Click OAuth Sign-In

The app SHALL let the user connect via the GitHub OAuth device flow. It SHALL display the user code and open the verification URL, and on authorization it MUST store the token in the Keychain and proceed to the dashboard. The token MUST NOT appear in logs, SQLite, or error output.

Scenario: Connect via device flow

  • GIVEN an unconnected user on the onboarding screen
  • WHEN they choose "Sign in with GitHub"
  • THEN the app shows a user code and opens github.com/login/device
  • AND once they authorize, the onboarding window hides, the dashboard opens, and a sync starts

Scenario: Authorization fails or expires

  • GIVEN a device flow in progress
  • WHEN the code expires or the user denies access
  • THEN the app surfaces an error on the onboarding screen
  • AND does not connect

Verification

  1. Build
    1.1 cargo check --manifest-path src-tauri/Cargo.toml compiles with the new command.
    1.2 npm run check reports 0 errors and 0 warnings.
  2. Wiring
    2.1 CLIENT_ID is set and device_flow::is_configured() returns true.
    2.2 connect_via_oauth is registered in the invoke handler and exposed in the api client.
  3. Runtime
    3.1 Clicking "Sign in with GitHub" shows a code and opens the verification URL.
    3.2 Authorizing in the browser hides onboarding, opens the dashboard, and starts a sync.
    3.3 An expired or denied attempt surfaces an error and does not connect.

Set the registered OAuth App client id and add a connect_via_oauth
command that starts the device flow, returns the user code, and polls in
the background to finish the connect (or emits oauth:error). The
onboarding 'Sign in with GitHub' button replaces the disabled placeholder.
@jamubc
jamubc merged commit d09809b into main Jun 15, 2026
1 check passed
@jamubc
jamubc deleted the feat/oauth-device-flow branch June 15, 2026 20:19
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