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
OIDC server_error after account delete + re-create (stale session) #452
After deleting an account via /idp/account/delete and re-creating it with the same username, OIDC authorization fails with:
Authentication Error — server_error — oops! something went wrong
This is a recurring issue.
Cause
The error in the logs:
TypeError: Cannot read properties of undefined (reading 'getOIDCScopeEncountered')
at Check.oidc.oidc (oidc-provider/lib/helpers/interaction_policy/prompts/consent.js:29:50)
at oidc-provider/lib/actions/authorization/interactions.js:18:17
The flow:
User deletes their account — account data and grants are removed
User re-creates account with same username
Client (e.g. mashlib-next) still has old session cookies/tokens and sends prompt=consent to /idp/auth
loadExistingGrant() in provider.js checks ctx.oidc.session which is undefined (stale session)
Returns undefined — no grant object
oidc-provider's consent check calls getOIDCScopeEncountered() on the undefined grant → TypeError → 500
Possible fixes
Clear OIDC session cookies on account deletion — when /idp/account/delete runs, ensure session cookies are invalidated so the browser doesn't send stale tokens
Guard in loadExistingGrant — return a new grant (auto-approve) when session exists but old grant is gone, rather than returning undefined
Error handler — catch this specific error and redirect to login instead of showing server_error
Steps to reproduce
Register an account on a JSS instance
Log in via OIDC from a client app
Delete the account via /idp/account/delete
Re-register with the same username
Try to log in again from the same browser → server_error
Activity
Add stale session recovery in renderError for consent crash (#452)
Address Copilot review: Secure attribute and broader error match (#452)
Gate stale session redirect on GET requests only (#452)
Fix OIDC server_error after account delete + re-create (#452)
Bump version to 0.0.193