This repository was archived by the owner on Apr 24, 2026. It is now read-only.
Description Phase 2: Authentication Migration (OAuth + Sessions)
Replace custom OAuth and session management with Quickslice-managed authentication.
Depends On
Completion of Phase 1 (architecture assessment)
Critical decision: OAuth strategy (Quickslice vs AT Protocol)
Objectives
Replace custom OAuth flow with Quickslice
Replace iron-session with Quickslice tokens
Update session retrieval in route handlers
Maintain all downstream compatibility
Tasks
Task 1: Create Quickslice Client Module
Task 2: Replace OAuth Initiate Endpoint
Task 3: Replace OAuth Callback Handler
Task 4: Update Session Management
Task 5: Update Agent Creation
Task 6: Update Middleware
Task 7: Delete Old OAuth Code
Task 8: Update Database (if needed)
Task 9: Update Environment Variables
Task 10: Testing
OAuth Flow Testing
Integration Testing
Files Modified
File
Changes
Backward Compat
src/lib/oauth/client.ts
DELETE
-
src/lib/oauth/storage.ts
DELETE
-
src/lib/oauth/normalize-url.ts
DELETE
-
src/app/api/oauth/initiate/route.ts
Rewrite
Yes (same endpoint)
src/app/oauth/callback/route.ts
Rewrite
Yes (same path)
src/lib/auth/session.ts
Rewrite
Yes (same functions)
src/lib/auth/atproto.ts
Update
Yes (same functions)
src/proxy.ts
Update
Yes (same behavior)
src/lib/db.ts
Update
Conditional
No Changes Needed
These work as-is because we maintain function signatures:
All API routes in src/app/api/profile/*
All dashboard pages
All form components
All auth checks (still call same functions)
Files to Create
src/lib/quickslice/
├── client.ts # GraphQL client instance
└── auth.ts # Session retrieval, token refresh
Risks
Risk
Mitigation
Session cookie format wrong
Test before/after, verify browser DevTools
OAuth callback doesn't set cookie
Debug with console.log, verify Set-Cookie headers
Existing user sessions invalidate
Document that users need to re-login once
Token refresh fails
Implement proper error handling, retry logic
Multi-environment config issues
Test on both local (http://) and prod (https://)
Success Criteria
Estimated Duration
2-3 weeks depending on Quickslice OAuth complexity
Next Phase
Once Phase 2 complete:
→ #91 : Phase 3: GraphQL Client & Hooks Setup
→ #92 : Phase 4: REST to GraphQL Migration (start with Affiliations)
Notes
Keep backward compatibility with function signatures
Any existing frontend code calling getSession() or getAgent() continues to work
Test extensively before moving to Phase 3
Document Quickslice-specific patterns for team
Reactions are currently unavailable
Phase 2: Authentication Migration (OAuth + Sessions)
Replace custom OAuth and session management with Quickslice-managed authentication.
Depends On
Objectives
Tasks
Task 1: Create Quickslice Client Module
Create
src/lib/quickslice/client.tsCreate
src/lib/quickslice/auth.tsgetQuicksliceSession()functionTask 2: Replace OAuth Initiate Endpoint
src/app/api/oauth/initiate/route.tscreateOAuthClient()call with Quickslice OAuthTask 3: Replace OAuth Callback Handler
src/app/oauth/callback/route.tsTask 4: Update Session Management
src/lib/auth/session.tsgetSession()to read Quickslice token from cookieshandleLogout()to clear token cookieTask 5: Update Agent Creation
src/lib/auth/atproto.tsgetAgent()functionTask 6: Update Middleware
src/proxy.tssidto Quickslice formatTask 7: Delete Old OAuth Code
src/lib/oauth/client.tssrc/lib/oauth/storage.tssrc/lib/oauth/normalize-url.tssrc/lib/oauth/Task 8: Update Database (if needed)
auth_sessiontable from databaseauth_statetable from databasesrc/lib/db.tsmigrationsTask 9: Update Environment Variables
QUICKSLICE_URLor similar env varsQUICKSLICE_CLIENT_IDif neededQUICKSLICE_SECRETif needed.env.exampleTask 10: Testing
OAuth Flow Testing
Integration Testing
/dashboardredirect works (authenticated users)/authredirect works (unauthenticated users)Files Modified
No Changes Needed
These work as-is because we maintain function signatures:
Files to Create
Risks
Success Criteria
Estimated Duration
2-3 weeks depending on Quickslice OAuth complexity
Next Phase
Once Phase 2 complete:
→ #91: Phase 3: GraphQL Client & Hooks Setup
→ #92: Phase 4: REST to GraphQL Migration (start with Affiliations)
Notes
getSession()orgetAgent()continues to work