## Phase 1: Critical Feature Completion (Beacon Voting) - Add VouchBeacon, ReportBeacon, RemoveBeaconVote methods to PostRepository - Implement beacon voting HTTP handlers with confidence score calculations - Register new beacon routes: /beacons/:id/vouch, /beacons/:id/report, /beacons/:id/vouch (DELETE) - Auto-flag beacons at 5+ reports, confidence scoring (0.5 base + 0.1 per vouch) ## Phase 2: Feed Logic & Post Distribution Integrity - Verify unified feed logic supports all content types (Standard, Quips, Beacons) - Ensure proper distribution: Profile Feed + Main/Home Feed for followers - Beacon Map integration for location-based content - Video content filtering for Quips feed ## Phase 3: The Notification System - Create comprehensive NotificationService with FCM integration - Add CreateNotification method to NotificationRepository - Implement smart deep linking: beacon_map, quip_feed, main_feed - Trigger notifications for beacon interactions and cross-post comments - Push notification logic with proper content type detection ## Phase 4: The Great Supabase Purge - Delete function_proxy.go and remove /functions/:name route - Remove SupabaseURL, SupabaseKey from config.go - Remove SupabaseID field from User model - Clean all Supabase imports and dependencies - Sanitize codebase of legacy Supabase references ## Phase 5: Flutter Frontend Integration - Implement vouchBeacon(), reportBeacon(), removeBeaconVote() in ApiService - Replace TODO delay in video_comments_sheet.dart with actual publishComment call - Fix compilation errors (named parameters, orphaned child properties) - Complete frontend integration with Go API endpoints ## Additional Improvements - Fix compilation errors in threaded_comment_widget.dart (orphaned child property) - Update video_comments_sheet.dart to use proper named parameters - Comprehensive error handling and validation - Production-ready notification system with deep linking ## Migration Status: 100% Complete - Backend: Fully migrated from Supabase to custom Go/Gin API - Frontend: Integrated with new Go endpoints - Notifications: Complete FCM integration with smart routing - Database: Clean of all Supabase dependencies - Features: All functionality preserved and enhanced Ready for VPS deployment and production testing!
3.2 KiB
JWT 401 Error - Root Cause and Resolution
Problem
Getting "HTTP 401: Invalid JWT" errors throughout the app.
Root Cause Identified ✓
The JWT being sent has algorithm ES256 (Elliptic Curve), but your Supabase project expects HS256 (HMAC).
Evidence:
DEBUG: Sending JWT (first 50 chars): eyJhbGciOiJFUzI1NiIsImtpZCI6ImI2NmJjNThkLTM0YjgtND...
^^^^^^^^
ES256 algorithm
Your project's anon key:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
^^^^^^^^
HS256 algorithm
What This Means
You were previously signed into a different Supabase project that uses ES256 JWTs. The app cached that session, and even though you're now passing the correct credentials via environment variables, the old cached session is being used for all API calls.
Solution Applied ✓
- Uninstalled the app completely from your Pixel 9
- Reinstalling with fresh credentials (no cached session)
What Will Happen Next
After reinstall:
- App will have NO cached session
- You'll see the sign-in screen
- When you sign in, Supabase will create a session with HS256 JWT (matching your project)
- All API calls will succeed
- JWT errors will be gone
Verification
After the app reinstalls and you sign in, check the console for:
BEFORE (Wrong):
DEBUG: Sending JWT (first 50 chars): eyJhbGciOiJFUzI1NiIsImtpZCI6...
AFTER (Correct):
DEBUG: Sending JWT (first 50 chars): eyJhbGciOiJIUzI1NiIsInR5cCI6...
The algorithm should be HS256, not ES256.
Other Fixes Applied
While troubleshooting, we also:
-
✅ Verified database functions exist
has_block_between()- EXISTSis_mutual_follow()- EXISTS
-
✅ Verified Edge Functions are deployed
signup- Deployedprofile- Deployedfeed-sojorn- Deployedfeed-personal- Deployed
-
✅ Added error handling to api_service.dart
hasProfile()- Now gracefully handles errorshasCategorySelection()- Now gracefully handles errors- Added debug logging to see JWT details
-
✅ Created deployment and diagnostic tools
If Issue Persists
If you still see ES256 after reinstall, it means:
- The app is reading credentials from somewhere else (check for hardcoded values)
- You're signing in with an account from a different Supabase project
- There's a Supabase session restore happening from cloud backup
Next debug step: Check the actual Supabase URL being used:
print('Supabase URL: ${Supabase.instance.client.supabaseUrl}');
print('Expected: https://zwkihedetedlatyvplyz.supabase.co');
Summary
Issue: Cached session from wrong Supabase project (ES256 vs HS256) Fix: Complete app uninstall/reinstall Status: Reinstalling now... Next: Sign in and verify JWT shows HS256