Reopening the console after an hour asks for the password even with a valid refresh token #214

Closed
opened 2026-11-16 15:15:54 +00:00 by jcoffey-dev · 1 comment
Owner

Reported on the forum (https://community.coffeylabs.org/t/232, post 27): the console installed as an app on an Android phone keeps signing him out, while the laptop stays signed in.

ProtectedRoute (src/components/layout/ProtectedRoute.tsx:18) decides "signed in" with isAuthenticated(), which only checks that the access token hasn't expired (src/stores/authStore.ts:157). The access token lasts an hour; the refresh token 30 days. So any fresh page load more than an hour after the last request goes to /login and on to the password page, even though apiFetch would have refreshed quietly. A laptop tab stays mounted and refreshes on its next request; Android kills background apps, so reopening is a cold load.

Fix: treat a stored refresh token as signed in (isAuthenticated() || !!refreshToken) and let the first request refresh; a refused refresh already ends the session. Add a test for the guard. Optional: refresh on visibilitychange/pageshow when the token is close to expiry.

Separately, he'll also need "Stay signed in on this device" turned on in the phone app; the setting is per browser.

Reported on the forum (https://community.coffeylabs.org/t/232, post 27): the console installed as an app on an Android phone keeps signing him out, while the laptop stays signed in. `ProtectedRoute` (`src/components/layout/ProtectedRoute.tsx:18`) decides "signed in" with `isAuthenticated()`, which only checks that the access token hasn't expired (`src/stores/authStore.ts:157`). The access token lasts an hour; the refresh token 30 days. So any fresh page load more than an hour after the last request goes to `/login` and on to the password page, even though `apiFetch` would have refreshed quietly. A laptop tab stays mounted and refreshes on its next request; Android kills background apps, so reopening is a cold load. Fix: treat a stored refresh token as signed in (`isAuthenticated() || !!refreshToken`) and let the first request refresh; a refused refresh already ends the session. Add a test for the guard. Optional: refresh on `visibilitychange`/`pageshow` when the token is close to expiry. Separately, he'll also need "Stay signed in on this device" turned on in the phone app; the setting is per browser.
jcoffey-dev added the
priority
p2
bug
labels 2026-11-16 15:15:54 +00:00
jcoffey-dev self-assigned this 2026-11-16 15:15:54 +00:00
jcoffey-dev added this to the 27.1 milestone 2026-11-16 15:22:54 +00:00
Author
Owner

Fixed in #219. Reopening the console no longer asks for the password while the refresh token is still good; the first request renews the sign-in. Thanks to khashmeshab for the report on the forum (https://community.coffeylabs.org/t/232). It'll be in the next console RC.

Fixed in #219. Reopening the console no longer asks for the password while the refresh token is still good; the first request renews the sign-in. Thanks to khashmeshab for the report on the forum (https://community.coffeylabs.org/t/232). It'll be in the next console RC.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: inbuxa/inbuxa-admin#214