Framework7 Router Guard Configuration for Expired Credential Handling
0 reputation · 14 Jul 2022, 01:13 UTC
Goal
Implement least‑privilege access in a Framework7 SPA by automatically blocking navigation to privileged pages when a user’s JWT or session token has expired, using router guards.
Constraints / Uncertainty
Framework7 core supplies router.beforeEach and page beforeIn callbacks but does not provide a built‑in token‑expiration interceptor or a centralized authentication state store. Developers must manually check token validity in each guard, which can lead to inconsistent enforcement if a new route is added without the check. It is unclear whether a global auth store should be introduced for routers to subscribe to, leaving the decision to each project.
What are the trade‑offs of implementing a global authentication store versus duplicating token‑expiry checks in every route guard?
How can teams guarantee that all protected routes consistently enforce role‑based checks without manual duplication?
Should Framework7 provide a built‑in middleware or plugin that automatically redirects to login when a token expires, or is this responsibility better left to application code?