From 65806df60577813dff0a6e1888d220e14a2249c0 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 21 Feb 2026 22:59:11 +0100 Subject: [PATCH] fix: keep token expiry in sync when skipping setUser from JWT When the setUser call is skipped for an already-loaded user, info.value.exp was never updated with the renewed token's expiry. This caused useRenewTokenOnFocus to compute a stale expiresIn, eventually forcing a logout even though the token was still valid. Now we always update exp from the JWT, even when skipping the full setUser call. --- frontend/src/stores/auth.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/stores/auth.ts b/frontend/src/stores/auth.ts index d88f6c230..6023eec99 100644 --- a/frontend/src/stores/auth.ts +++ b/frontend/src/stores/auth.ts @@ -300,6 +300,9 @@ export const useAuthStore = defineStore('auth', () => { // where the display name briefly reverts to the username. if (info.value === null || info.value.id !== jwtUser.id) { setUser(jwtUser, false) + } else { + // Always keep exp in sync so token renewal checks stay accurate + info.value.exp = jwtUser.exp } } catch (_) { logout()