feat(desktop): add OAuth authentication for desktop app

Merged
SA
1y ago
+1824-106

Summary

  • Implements OAuth authentication flow for the desktop app using PKCE
  • Adds token refresh mechanism with 30-day refresh tokens for persistent sessions
  • Creates intermediate web callback page for desktop auth redirects
  • Adds script to register superset-dev:// deep links in development on macOS

Changes

  • API: Token exchange and refresh endpoints for desktop auth
  • Desktop: Auth service with PKCE, token storage, auto-refresh logic
  • Desktop: AuthButton component in top bar
  • Web: /auth/desktop/callback page for OAuth redirects
  • Web: /api/auth/desktop/[provider] endpoint to initiate OAuth flow
  • Desktop: Dev protocol handler script for macOS deep links

Test plan

  • Sign in via Google OAuth from desktop app
  • Verify token refresh works (tokens auto-refresh before expiry)
  • Verify session persists across app restarts
  • Test sign out clears session
  • Test deep links work in development on macOS

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Desktop app: sign-in with GitHub and Google, deep-link callback handling, and automatic session/token management.
    • New Sign‑In screen, Superset logo, and Account Settings with profile display and sign-out.
    • Desktop ↔ Web auth flow with one‑click redirect to the app and improved single‑instance deep‑link handling.
  • Chores
    • Added cross‑platform protocol registration and configuration improvements for desktop builds.

✏️ Tip: You can customize this high-level summary in your review settings.