Skip to content

fix: delete current session on logout instead of only expiring the cookie#16079

Open
moktamd wants to merge 1 commit intopayloadcms:mainfrom
moktamd:fix/logout-session-deletion
Open

fix: delete current session on logout instead of only expiring the cookie#16079
moktamd wants to merge 1 commit intopayloadcms:mainfrom
moktamd:fix/logout-session-deletion

Conversation

@moktamd
Copy link
Copy Markdown

@moktamd moktamd commented Mar 27, 2026

Fixes #16061

The logout operation guarded session deletion behind disableLocalStrategy !== true, which meant sessions were never cleaned up when using external auth strategies with sessions enabled. Even with the local strategy, the inline session filtering reimplemented logic that already existed in revokeSession.

Changes:

  • Remove the disableLocalStrategy gate so sessions are cleaned regardless of auth strategy
  • Use the existing revokeSession helper for single-session logout instead of reimplementing the filtering
  • Keep the allSessions path for clearing all sessions at once

…okie

The logout operation skipped session deletion when disableLocalStrategy
was true, causing sessions to accumulate in the users_sessions table.
For single-session logout, use the existing revokeSession helper instead
of reimplementing session filtering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logout doesn't delete the current user session

1 participant