Repository navigation
Add interactive GitHub OAuth fallback for API_TOKEN - #14
Merged
Merged
Conversation
Adds an OAuth client id/secret path for authenticating with GitHub (issue #12): when API_TOKEN/GITHUB_TOKEN is missing or GitHub no longer accepts it, and OAUTH_CLIENT_ID/OAUTH_CLIENT_SECRET are configured, a small local web server walks the user through the authorization-code flow to obtain a token. A deployment that only sets API_TOKEN is unaffected — the whole fallback, including the PAT validity check, is skipped when no OAuth settings are configured. Also documents the new configuration in README.md and .env.example, and adds CLAUDE.md for future AI-assisted sessions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CHYGjRjhdsemy2RwL5wBrT
…ution-jogxis # Conflicts: # Cargo.toml # src/config.rs # src/main.rs
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.
Summary
Closes #12.
OAUTH_CLIENT_ID/OAUTH_CLIENT_SECRET(withGITHUB_CLIENT_ID/GITHUB_CLIENT_SECRETaliases, matching the existingAPI_TOKEN/GITHUB_TOKENpattern) as an interactive fallback to the existing PAT-based auth.src/oauth.rs: ifAPI_TOKEN/GITHUB_TOKENis present, it's checked againstGET https://api.github.com/userand used as-is if GitHub still accepts it. Otherwise — if an OAuth App's client id/secret is configured — a small localaxumweb server walks the user through GitHub's authorization-code flow (a landing page with a "Sign in with GitHub" link, a/callbackroute that validates the CSRFstateand exchanges the code for an access token) and the resulting token is used instead.API_TOKENis completely unaffected, with zero extra network calls.README.md(configuration table + new "Authenticating with GitHub" section) and.env.examplewith the new variables.CLAUDE.md(didn't exist yet) documenting the module map and project conventions.docs/ai-logs/sessions/per this repo's Generative AI disclosure policy.Test plan
cargo fmt -- --checkcargo clippy --all-targets -- -D warningscargo test— 37 passing, including new unit tests forresolve_oauth_settingsand OAuth callback validation, plus an end-to-end test that binds the real local callback server and exercises the landing page and a forged-statecallback (without reachinggithub.com)cargo build🤖 Generated with Claude Code
https://claude.ai/code/session_01CHYGjRjhdsemy2RwL5wBrT
Generated by Claude Code