Skip to content

feat: implement Raindrop.io OAuth 2.0 authentication for bookmarks#6

Merged
foreveryh merged 12 commits into
masterfrom
feature-a
Aug 31, 2025
Merged

feat: implement Raindrop.io OAuth 2.0 authentication for bookmarks#6
foreveryh merged 12 commits into
masterfrom
feature-a

Conversation

@foreveryh

Copy link
Copy Markdown
Owner

Summary

  • Implement complete OAuth 2.0 authentication flow for Raindrop.io bookmarks integration
  • Add support for multiple token storage strategies (Vercel KV, Supabase, Environment Variables)
  • Fix build-time authentication issues that caused deployment failures
  • Add comprehensive admin interface for OAuth setup and status monitoring

Key Changes

Authentication System

  • OAuth 2.0 Implementation: Complete authorization flow with secure token exchange
  • Dynamic Token Manager: Automatically selects best storage method based on available services
  • Encrypted Token Storage: All tokens encrypted before storage for security
  • Automatic Token Refresh: Access tokens automatically renewed when expired

Build & Deployment Fixes

  • Build-time Safety: Graceful handling of missing authentication during static generation
  • Error Recovery: Improved error handling and debugging throughout OAuth flow
  • Environment Validation: Comprehensive environment variable validation and debugging

Documentation & Monitoring

  • Admin Interface: Web-based OAuth setup at /admin/raindrop-setup
  • Status Monitoring: Real-time authentication status and token information
  • Complete Documentation: Updated README with step-by-step OAuth setup guide

Files Modified

  • src/app/api/auth/raindrop/callback/route.js - OAuth callback with enhanced debugging
  • src/app/api/auth/raindrop/status/route.js - Dynamic token manager status API
  • src/app/api/auth/raindrop/clear/route.js - Token clearing with dynamic manager
  • src/lib/raindrop-with-auth.js - Build-safe authenticated API requests
  • README.md - Complete OAuth setup documentation
  • docs/work-log-2025-08-31.md - Detailed implementation log

Test Plan

  • OAuth authorization flow works end-to-end
  • Token exchange and encryption successful
  • Authentication status correctly displayed in admin interface
  • Bookmarks page displays content after authentication
  • Build process completes without authentication errors
  • Token refresh mechanism works automatically
  • All three token storage strategies function correctly

🤖 Generated with Claude Code

foreveryh and others added 12 commits August 31, 2025 21:34
The token exchange URL was incorrectly using the API endpoint instead of the OAuth endpoint. Fixed to use https://raindrop.io/oauth/access_token directly.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
The v1 OAuth endpoint was returning Internal Server Error, while the v2 endpoint works correctly and redirects to the login page as expected.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add detailed logging for token exchange debugging
- Fix token manager selection in callback to use dynamic approach
- Add better error reporting for token response validation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add detailed logging for token exchange and storage process
- Fix env-token-manager to return encrypted token properly
- Add better error reporting for token response validation
- Improve debugging information for OAuth callback process

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add detailed error reporting for OAuth token response
- Separate validation for access_token and refresh_token
- Add comprehensive request logging for debugging
- Improve error messages to identify specific issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…or handling

- Add debugging for client ID and secret validation
- Improve error handling for Raindrop.io API error format
- Show credential lengths and prefixes for debugging

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Prevent build failures when OAuth tokens are not configured
- Return empty results instead of throwing errors during static generation
- Add specific error handling for authentication-required scenarios
- Improve error messages for debugging authentication issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add detailed logging at callback entry point
- Log request URL and parameters for debugging
- Ensure we can see when callback is triggered

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Show all RAINDROP env keys available
- Display actual values for debugging
- Check Vercel environment detection
- Add error logging for missing credentials

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix status API to use correct token manager based on environment
- Fix clear API to use dynamic token manager selection
- Add compatibility for different token manager interfaces
- Add debugging for token status checks

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive work log for 2025-08-31 OAuth implementation
- Update README with complete OAuth 2.0 setup instructions
- Replace outdated token-based auth with OAuth flow documentation
- Include troubleshooting guide and multiple storage strategies
- Document manual encrypted token setup process

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 31, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
onur-dev-blog-5qsa Ready Ready Preview Comment Aug 31, 2025 10:37pm

@foreveryh
foreveryh merged commit 5777b43 into master Aug 31, 2025
2 of 4 checks passed
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.

1 participant