Phase 3: The Switchover - Implementation Guide
Overview
Architecture Change
BEFORE (Phase 2):
┌─────────────────────────────────────────┐
│ aethex.dev (Corp) │
│ ┌──────────────────────────────────┐ │
│ │ Local Auth (Email/Password) │ │
│ │ Discord OAuth (Local handling) │ │
�� │ Session Management │ │
│ └──────────────────────────────────┘ │
│ ↓ │
│ Supabase (shared with Foundation) │
└─────────────────────────────────────────┘
AFTER (Phase 3):
┌──────────────────────────────────────────────────┐
│ aethex.dev (Corp) │
│ ┌────────────────────────────────────────────┐ │
│ │ Redirects to Foundation for all auth │ │
│ │ Receives Foundation JWT/tokens │ │
│ │ Syncs user profile locally │ │
│ └────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────┘
↓
│ OAuth Flow
↓
┌──────────────────────────────────────────────────┐
│ aethex.foundation (Guardian - Identity Issuer) │
│ ┌────────────────────────────────────────────┐ │
│ │ Discord OAuth (All Discord connections) │ │
│ │ Email/Password Auth │ │
│ │ All other OAuth providers │ │
│ │ Passport issuance │ │
│ └────────────────────────────────────────────┘ │
│ ↓ │
│ Supabase (Single source of truth) │
└──────────────────────────────────────────────────┘Implementation Checklist
Step 1: Environment Setup ✅
Step 2: Foundation OAuth Client Library ✅
Step 3: Backend OAuth Endpoints ✅
Step 4: Frontend Login Page Refactoring ✅
Step 5: Remove Old Authentication Endpoints
Step 6: User Session Handling
Authentication Flow Diagram
Configuration Requirements from Foundation
Testing Phase 3
Local Testing
Production Testing
Migration Path
For Existing Users
For New Users
Rollback Plan
Deprecation Timeline
After Phase 3 Deployment
Future Improvements (Phase 4+)
Support & Troubleshooting
Common Issues
Debug Endpoints
Code References
Last updated
