Securing PWA authentication offline
summary
A PWA for African fish farms authenticates users offline by binding the access token to the user (not tenant), using a deferred-promise refresh flow shared between app and service worker to avoid duplicate refreshes, and falling back to queued replay after 10 seconds when background sync lacks support. Front end stacks are Vue + Vuex + LocalForage, caching via Cache Storage and service worker, auth with oidc-client and server IdentityServer, and background uploads via Workbox background sync; the system works in remote offline scenarios.
AI-written summary · about
chapters (14)
- 0:00Introduction to PWA auth
- 1:49Tech stack and requirements
- 2:33Offline authentication challenges
- 3:58User manager setup in main.js
- 5:02Token refresh logic
- 7:08Service worker token handling
- 8:51Refresh token function details
- 9:16Error handling in auth flow
- 10:00Background sync API overview
- 11:05Workbox background sync setup
- 12:10Custom sync handler for auth
- 13:15Queue processing in background sync
- 14:20Service worker fallback issues
- 15:23Final tips and Q&A
