Skip to content

Conversation

@guzus
Copy link
Owner

@guzus guzus commented Jan 13, 2026

Summary

  • Add GitHub OAuth flow for secure account connection (primary method)
  • Add Personal Access Token input as fallback for advanced users
  • Implement backend services for token management and validation
  • Add GitHub settings section in frontend settings view

Changes

Backend

  • GitHubAppService: New service for OAuth token exchange, refresh, and validation
  • API Endpoints:
    • GET /api/github/status - Get user's GitHub auth status
    • GET /api/github/oauth/url - Generate OAuth authorization URL
    • POST /api/github/oauth/callback - Complete OAuth flow
    • POST /api/github/disconnect - Disconnect GitHub App
    • POST /api/github/pat - Set and validate PAT
    • DELETE /api/github/pat - Clear PAT
    • POST /api/github/pat/validate - Validate PAT without saving
  • GitService: Modified to support per-user tokens for clone/push operations
  • UserConfigManager: Extended with GitHub credential methods
  • Types: Added GitHubAppConnection interface and githubPat/github fields to UserConfig

Frontend

  • GitHub Settings: New settings section with OAuth and PAT options
  • API Client: Added GitHub authentication methods

Configuration

To enable GitHub OAuth, set these environment variables:

  • GITHUB_APP_CLIENT_ID - GitHub OAuth App client ID
  • GITHUB_APP_CLIENT_SECRET - GitHub OAuth App client secret

Without these, only PAT authentication will be available.

Test Plan

  • Test GitHub OAuth flow with GitHub App credentials
  • Test PAT entry and validation
  • Test PAT removal
  • Test OAuth disconnection
  • Verify token is used for private repo clone/push

🤖 Generated with Claude Code

guzus and others added 14 commits January 13, 2026 16:36
Users can now connect their GitHub accounts for private repository access:

- GitHub OAuth flow (primary): Secure OAuth-based connection via GitHub App
- Personal Access Token (fallback): Manual PAT entry for advanced users

Backend changes:
- Added GitHubAppService for OAuth token exchange and refresh
- Added GitHub API endpoints (/api/github/status, /api/github/oauth/*, /api/github/pat)
- Updated GitService to support per-user tokens for clone/push operations
- Extended UserConfigManager with GitHub credential methods
- Added GitHubAppConnection and PAT fields to UserConfig type

Frontend changes:
- Added GitHub settings section in settings view
- OAuth "Connect with GitHub" button
- PAT input with validation
- Connection status display

Required env vars for OAuth: GITHUB_APP_CLIENT_ID, GITHUB_APP_CLIENT_SECRET

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add `repo` scope to NextAuth GitHub provider for automatic repo access
- Auto-sync GitHub token from session to backend on sign-in
- Add /api/github/sync endpoint for token synchronization
- Simplify GitHub settings UI (auto-connected for GitHub sign-in users)
- Remove duplicate GITHUB_APP_CLIENT_* env vars from backend
- Improve login page with loading state and privacy indicator
- Add success feedback for auth operations
- Better error messages throughout auth flow

Users who sign in with GitHub now automatically have private repo access.
PAT remains as fallback for Google sign-in users.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add private repo access benefit indicator on login page
- Show GitHub auth hints in clone/create workspace modals
- Display connected GitHub account in create repo flow
- Improve error messages for auth-related clone/create failures

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
API errors now display the actual error message from the backend
instead of generic status codes, improving user feedback when
operations fail.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Show spinner while signing out to prevent double-clicks
- Redirect to home after sign-out
- Consistent callback URLs for sign-in/out

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Display GitHub icon next to username for users who signed in with
GitHub, with tooltip indicating repos are connected. Helps users
understand their auth context.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add screen reader support with role="alert", aria-live="polite",
and aria-hidden on decorative icons for better accessibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add aria-label to settings close button
- Add role="alert/status" and aria-live to success/error messages
- Add proper label association for PAT input with htmlFor/id
- Add aria-describedby for PAT input hint text
- Mark decorative icons as aria-hidden

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add role="alert" and aria-live to error messages
- Add proper label associations with htmlFor/id for all inputs
- Add aria-describedby for input hints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Check session status on login page mount
- Redirect authenticated users to home page
- Show loading spinner while checking auth status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add autoComplete="off" to prevent password autofill confusion
- Add spellCheck={false} for token and URL inputs
- Prevents browser from suggesting unrelated saved credentials

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace img with Next.js Image component for automatic optimization
- Improves LCP and reduces bandwidth for avatar images

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add signInError state to track client-side sign-in failures
- Display network error message when GitHub OAuth can't connect
- Combined error display handles both URL params and local errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants