Skip to content

Conversation

@factory-droid
Copy link
Contributor

@factory-droid factory-droid bot commented Jun 10, 2025

Supabase Authentication Integration

This PR integrates Supabase authentication into the Path To Python platform while maintaining all existing functionality:

✅ What's Added:

  • Multiple Login Methods:
    • Magic Link authentication (passwordless email login)
    • GitHub authentication (OAuth)
    • Anonymous guest access (Supabase-based)
    • Existing keystore system remains fully functional

✅ Improvements:

  • Universal Path Handling:
    • Works in all environments (localhost, GitHub Pages, offline)
    • Dynamic base path detection for subdirectory deployments
    • Preserves all existing UI styling and functionality

✅ Technical Details:

  • Adds @supabase/supabase-js dependency
  • Creates Supabase client configuration using provided credentials
  • Extends AuthContext to support both keystore and Supabase auth
  • Adds dynamic URL handling for redirect flows
  • Updates LoginPage UI with additional tabs while keeping original design
  • Ensures browser history and routing works across all environments

Testing:

  • Confirm original keystore login still works
  • Test Magic Link login (requires email)
  • Test GitHub login
  • Test Guest login
  • Verify UI style and components remain unchanged

Note:

This PR was created by FACTORY AI to implement the requested authentication features while preserving the original UI, styles, and functionality of the Python learning platform.


Factory Session: https://app.factory.ai/sessions/uvRuYjqbaaKmtFGIpEh1

factory-droid bot added 3 commits June 10, 2025 18:08
- Install @supabase/supabase-js dependency
- Create Supabase client configuration in src/lib/supabase.ts
- Add Magic Link and GitHub authentication tabs to LoginPage
- Update guest mode to use Supabase anonymous sign-in
- Extend AuthContext to support both keystore and Supabase authentication
- Update Index page to handle both authentication methods
- Maintain all existing UI/UX design and functionality
- Keep keystore authentication fully functional alongside Supabase options
- Use window.location.href instead of window.location.origin for exact page redirects
- Add getURL helper function in supabase.ts for dynamic URL handling
- Update AuthContext to use getURL for GitHub and Magic Link redirects
- This ensures users return to exactly where they started regardless of hosting location
- Works universally for localhost (any port), local HTML files, or deployed websites
- Add getBasePath() helper to detect application base URL dynamically
- Configure BrowserRouter with dynamic basename for universal path support
- Update URL handling to work with GitHub Pages or any subdirectory host
- Support local file usage, offline mode, and any deployment environment
- Ensure all relative paths work correctly regardless of hosting location
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