Title: IdP errors with SessionNotFound on stale session cookies instead of expiring + restarting the interaction · Issue #526 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: IdP errors with SessionNotFound on stale session cookies instead of expiring + restarting the interaction · Issue #526 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: IdP errors with SessionNotFound on stale session cookies instead of expiring + restarting the interaction · Issue #526 · JavaScriptSolidServer/JavaScriptSolidServer
Description: Symptom After re-provisioning a pod (or otherwise rotating cookie-signing keys), a browser that still holds an old _session / _interaction cookie for the IdP origin fails sign-in at the consent / "Allow access" step. provider.interaction...
Open Graph Description: Symptom After re-provisioning a pod (or otherwise rotating cookie-signing keys), a browser that still holds an old _session / _interaction cookie for the IdP origin fails sign-in at the consent / "...
X Description: Symptom After re-provisioning a pod (or otherwise rotating cookie-signing keys), a browser that still holds an old _session / _interaction cookie for the IdP origin fails sign-in at the consent / &...
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/526
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"IdP errors with SessionNotFound on stale session cookies instead of expiring + restarting the interaction","articleBody":"## Symptom\n\nAfter re-provisioning a pod (or otherwise rotating cookie-signing keys), a browser that still holds an old `_session` / `_interaction` cookie for the IdP origin fails sign-in at the **consent / \"Allow access\"** step. `provider.interactionFinished(...)` throws and the request 400s:\n\n```\nSessionNotFound: invalid_request — \"session not found\"\n at #getInteraction (oidc-provider/lib/provider.js)\n at Provider.interactionResult / interactionFinished\n\"Promise errored, but reply.sent = true was set\"\n```\n\nLogin + the interaction pages all succeed; only the final `confirm` (interactionFinished) dies. The user is stuck until they manually clear site data for the IdP origin. Incognito works (no stale cookie), which pinpoints it.\n\n## Repro\n\n1. Sign in to a pod, leave the browser cookies in place.\n2. Re-provision / reinstall so the persisted cookie keys change (or the stored session/interaction is gone).\n3. Sign in again from the same (non-incognito) browser → reaches consent → \"Allow access\" → `SessionNotFound`.\n\n(Surfaced repeatedly during the Android app dev cycle — js-pod/android — across reinstalls; a fresh user wouldn't hit it, but a reinstall does.)\n\n## Why it matters\n\nA stale cookie shouldn't be a dead end. The user has no in-app way to recover; they have to know to clear site data, which a normal user won't.\n\n## Existing precedent (the fix is small)\n\nJSS already handles the *analogous* deleted-account case and already has the helpers:\n\n- `src/idp/provider.js:268,407,420` — guard that, when a session/grant is missing due to stale cookies, calls `expireSessionCookiesKoa(ctx)` and redirects back to retry.\n- `src/idp/cookies.js` — `expireSessionCookies(reply, request)` and `expireSessionCookiesKoa(ctx)`.\n- `src/idp/interactions.js:221-224` — already wraps one `interactionFinished` in try/catch with a fallback (\"interactionFinished failed, using fallback\").\n\n## Proposed fix\n\nIn the interaction handlers that call `provider.interactionFinished(...)` (`src/idp/interactions.js` — the `/confirm` path via `src/idp/index.js:408`, plus the other call sites at lines ~166, 289, 606, 644, 823), catch `SessionNotFound` (err.name === 'SessionNotFound') and, instead of erroring, **expire the session/interaction cookies and 303 back to the authorization URL to restart the interaction cleanly** — mirroring the existing deleted-account guard. Net effect: a stale cookie self-heals into a fresh login instead of a 400.","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-05-24T09:02:11Z","url":"https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/526"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8c23bebb-b9e3-c263-9548-6099f410134b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF04:1AC597:2A9D7EE:38601DA:6B0390D7 |
| html-safe-nonce | df1930fda3126b86f8d38a017637890fa906f58289ddb8773f3783f350cf13dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjA0OjFBQzU5NzoyQTlEN0VFOjM4NjAxREE6NkIwMzkwRDciLCJ2aXNpdG9yX2lkIjoiMzQxNTk0OTcxNzUxMzkzMzAxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a6f6140a82f3e8cded209912097f0889ec4330535377d97610882fc977b78460 |
| hovercard-subject-tag | issue:4511037233 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/526/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b6a818abf9824817384d0312d5e534af60569471ceed6fdaddeefd2dd85cb324/JavaScriptSolidServer/JavaScriptSolidServer/issues/526 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b6a818abf9824817384d0312d5e534af60569471ceed6fdaddeefd2dd85cb324/JavaScriptSolidServer/JavaScriptSolidServer/issues/526 |
| og:image:alt | Symptom After re-provisioning a pod (or otherwise rotating cookie-signing keys), a browser that still holds an old _session / _interaction cookie for the IdP origin fails sign-in at the consent / "... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width