feat: one-click GitHub sign-in via OAuth device flow - #10
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Onboarding offered the
ghCLI 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
credential::device_flow::CLIENT_ID.connect_via_oauthcommand that starts the device flow, returns the user code and verification URL, and polls on a background thread to finish the connect or emitoauth:error.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
github.com/login/deviceScenario: Authorization fails or expires
Verification
1.1
cargo check --manifest-path src-tauri/Cargo.tomlcompiles with the new command.1.2
npm run checkreports 0 errors and 0 warnings.2.1
CLIENT_IDis set anddevice_flow::is_configured()returns true.2.2
connect_via_oauthis registered in the invoke handler and exposed in the api client.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.