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
- User clicks 'Login with GitHub'
- Redirect to GitHub authorization
- GitHub redirects back with code
- Worker exchanges code for token
- Token stored in KV, session cookie set
- 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
Time Estimates
- With AI: 145 minutes
- Without AI: 960 minutes
Description
Add GitHub OAuth login flow using Cloudflare Workers as the backend.
Why Needed
Implementation Details
Architecture
Files to Create/Modify
Security Considerations
Acceptance Criteria
Time Estimates