bef80c5bab
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