Repository navigation
feat(web): keep users signed in for 7 days instead of 24 hours - #687
Conversation
The middleware capped the Supabase auth cookies at 24 hours, so a browser that went a day without a server-side session refresh was signed out. Raise the window to 7 days; it still slides with each refresh. Also pass supabase-ssr's cookie deletions (maxAge 0) through unchanged. The override previously turned them into 24-hour empty cookies, which a 7-day window would have stretched to a week. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com>
|
The dashboard preview for this PR — redeployed on each push that changes the web app.
Preview always points at this PR's latest commit; Deployment is the immutable build of |
✅ No issues foundRaises the middleware's Supabase auth-cookie max-age from 24 h to 7 days and passes supabase-ssr's maxAge:0 deletions through unchanged. Checked against @supabase/ssr 0.6.1; nothing actionable found. Checked: 3 of 3 changed files read · 2 of 2 dependent files traced · 4 possible issues → 0 confirmed → 0 posted What this change reaches — 2 changed exports · 2 dependent files · 2 checkedflowchart LR
subgraph pr["Changed in this PR"]
s1["sessionCookieMaxAge<br/>added"]:::changed
s2["SESSION_MAX_AGE_SECONDS<br/>added"]:::changed
end
s1c1["packages/web/src/middleware.ts<br/>✓ checked"]:::ok
s1c2["packages/web/src/lib/auth/session-cookie.spec.ts<br/>✓ checked"]:::ok
s2c1["packages/web/src/lib/auth/session-cookie.spec.ts<br/>✓ checked"]:::ok
s1 --> s1c1
s1 --> s1c2
s2 --> s2c1
classDef changed fill:#eef2ff,stroke:#6366f1,color:#1e1b4b
classDef ok fill:#e7f6ec,stroke:#16a34a,color:#14532d
classDef partial fill:#fef9c3,stroke:#ca8a04,color:#713f12
classDef unknown fill:#f3f4f6,stroke:#9ca3af,stroke-dasharray:4 3,color:#374151
classDef bad fill:#fde8e8,stroke:#dc2626,color:#7f1d1d
classDef warn fill:#fff4e5,stroke:#d97706,color:#78350f
classDef imports fill:#f8fafc,stroke:#64748b,stroke-dasharray:4 3,color:#1e293b
Review details
Found Quality — produced 4 → posted inline 0 · cleared 0 · carried forward 0 · deferred 0 · below-bar 0 Run full · 65 lines in delta · tier deep · depth checkout Nothing to report — integrations (not activated), severity, 0 files skipped.
|
Summary
Dashboard users were signed out after 24 hours without a server-side session refresh, because the middleware capped the Supabase auth cookies at
maxAge: 86400. This raises that window to 7 days. It still slides: every refresh re-issues the cookies, so anyone who opens the dashboard at least once a week stays signed in.Changes
packages/web/src/lib/auth/session-cookie.ts, dependency-free so it is edge-safe. It exportsSESSION_MAX_AGE_SECONDS = 7 daysandsessionCookieMaxAge(). Co-located spec included.middleware.tsuses it instead of the inline 24 h constant.value: "",maxAge: 0, written on sign-out and when a session cookie is re-chunked) through unchanged. Until now the override turned them into 24 h empty cookies; with a 7-day window they would have stayed in the browser for a week.Context
jwt_expiry: 1 h hosted per the CI comment, 24 h insupabase/config.toml) is unchanged. The cookie only needs to outlive it so the refresh token is still there when it expires.config.toml, so it can't be checked from the repo.llms.txtsection describes how long a sign-in lasts, so neither needed an update./polishandreview-loopsteps were not run.