You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(platform): an organization's idle timeout signs SSO sessions out while they are in use #5249
Found while working on #5164 (board task TALE-260) and not fixed there. Read from the code at feature-train610007bd07ee9bea6ccc2667dc9d0641c308718f; not reproduced against a running deployment.
What happens
With SESSION_IDLE_TIMEOUT_MINUTES unset, an organization's Session idle timeout signs a person who signed in through SSO out one window after sign-in, however actively they use Tale.
Why
createSsoUserSession (services/platform/backend/domains/sso/service.ts) inserts the session row itself. While the variable is unset, the row's expiresAt is 30 days ahead (sessionExpiryMs(now, 30 days)).
Better Auth 1.7.7 refreshes a session (writes expiresAt and updatedAt) at the first request once expiresAt - expiresIn + updateAge has passed (shouldBeUpdated in better-auth/dist/api/routes/session.mjs). expiresIn is 7 days, so a 30-day row is first refreshed about 23 days after sign-in. Until then its updatedAt stays at the sign-in time.
The idle sweep (services/platform/backend/domains/governance/session-idle.ts) reads updatedAt as the session's last use. It revokes a live session of a member of an organization whose window is on once updatedAt is older than that window.
So the sweep revokes the SSO session one window after sign-in, plus the cookie cache's length when SESSION_COOKIE_CACHE_SECONDS is set.
With the variable set, the row gets the window as its lifetime, and Better Auth refreshes it as usual. Only the unset case is affected.
The same shape: "don't remember me"
A session from Better Auth's email sign-in with rememberMe: false also has a fixed lifetime of one day, and Better Auth never refreshes it. Under a window, the sweep revokes it one window after sign-in, whether the variable is set or not.
Tale's own sign-in form does not send rememberMe: false, so only callers of the auth API make such sessions.
Expected
Under an idle window, an SSO session in use stays signed in. It goes once it has been idle for the window, like any other session.
The fix of this issue is on its way to train (board task TALE-349, branch fix/sso-session-idle-refresh). Every authorization now records the session's use, which keeps single sign-on and "don't remember me" sessions in use signed in under an idle window.
Split off as #5264: on the feature line, that record undoes part of the write saving of #5164. #5264 proposes recording the use only where Better Auth's own refresh does not.
Activity
tale-code-bot commentedon Nov 1, 2026
The fix of this issue is on its way to
train(board task TALE-349, branchfix/sso-session-idle-refresh). Every authorization now records the session's use, which keeps single sign-on and "don't remember me" sessions in use signed in under an idle window.Split off as #5264: on the feature line, that record undoes part of the write saving of #5164. #5264 proposes recording the use only where Better Auth's own refresh does not.
fix(platform): keep a single sign-on session in use signed in
test(platform): let the session-use lane wait for its org's scaffold
test(platform): let the session-use lane wait for its org's scaffold
docs: write the v0.5.96 release notes
docs: write the v0.5.96 release notes