Skip to content

[FEATURE] Implement GitHub OAuth authentication with Cloudflare Workers #191

Description

@ascender1729

Description

Add GitHub OAuth login flow using Cloudflare Workers as the backend.

Why Needed

  • Higher API rate limits when authenticated
  • Access to private repos (optional)
  • Personalized features
  • Required for bookmarking and sync

Implementation Details

  • Create OAuth flow endpoints in Workers
  • Handle authorization redirect
  • Exchange code for access token
  • Store token securely (encrypted in KV)
  • Implement logout functionality

Architecture

  1. User clicks 'Login with GitHub'
  2. Redirect to GitHub authorization
  3. GitHub redirects back with code
  4. Worker exchanges code for token
  5. Token stored in KV, session cookie set
  6. Frontend detects authenticated state

Files to Create/Modify

  • workers/auth.ts (OAuth endpoints)
  • src/lib/auth.ts (frontend auth state)
  • src/components/shared/LoginButton.svelte

Security Considerations

  • Use state parameter for CSRF protection
  • Store tokens encrypted
  • Short session expiry
  • Secure cookie flags

Acceptance Criteria

  • Login with GitHub button works
  • OAuth flow completes successfully
  • Token stored securely
  • Logout clears session
  • Rate limits improved when authed

Time Estimates

  • With AI: 145 minutes
  • Without AI: 960 minutes

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions