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
fix(client): break /admin unauthorized loop for non-admin users (#345)
* fix(client): break /admin unauthorized loop for non-admin users
When a Users-collection session was active, Payload's admin panel ran
the Users authjs strategy on /admin requests and rendered the
Unauthorized view; the "Log out" link looped back to the same page
because Payload's native logout never cleared the NextAuth cookie.
Gate the Users + AnonymousUsers authjs strategies by request path:
return no user when x-current-path starts with /admin. Middleware now
propagates the pathname on /admin and /v1 too. Admin panel shows the
login form instead of the unauthorized view, removing the loop. Drops
the obsolete Admins beforeOperation workaround.
* style: apply prettier to middleware matcher
* fix(quality): resolve duplicated authjs strategy in Users + AnonymousUsers
Extracts the NextAuth-backed Payload strategy and the /logout endpoint
into a shared module so both collections call the same implementation.
Brings new-code duplicated lines density back under the 3% quality gate
threshold without changing runtime behavior.
0 commit comments