2 Commits

Author SHA1 Message Date
aewing 221e9d1f53 fixed request for reauth on clicking show folder 2026-01-10 19:39:57 +00:00
aewing bef80c5bab feat: implement robust TokenManager for field app resilience
PRODUCTION CRITICAL: Enhanced token lifecycle management

Features:
- 3-tier storage (PB authStore → IndexedDB → localStorage)
- Continuous background token refresh (every 20 min)
- Exponential backoff retry queue for network failures
- Stale token fallback for offline operation
- Cross-tab sync via IndexedDB
- Never forces logout on token expiry
- Network recovery detection and auto-refresh

Changes:
- Created token-manager.js with TokenManager class
- Updated signin.html to initialize TokenManager on login
- Updated index.html to use TokenManager for all API calls
- Simplified token extraction logic (centralized in TokenManager)
- Removed manual localStorage token management
- Added proper cleanup on signout

Benefits:
- Users stay authenticated during network interruptions
- Tokens always warm (proactive refresh)
- Field app resilient to poor connectivity
- No unnecessary re-authentication prompts
- Works offline with cached tokens
2026-01-08 17:33:07 +00:00