Commit 2a085a6
committed
fix(client): skip basic auth for payload paths so SDK works server-side
#345 widened the middleware matcher to include /admin and /v1 (needed so
the admin panel and Payload REST receive the x-current-path header that
gates the authjs strategy and breaks the /admin unauthorized loop).
Side effect: the basic-auth gate that previously only fronted the app
shell now also fronts /v1, so any server-to-self SDK call goes through
the gate and gets 401 — login (authorize -> sdk.login) and verify-email
(server action -> sdk.verifyEmail) both broke on envs with basic auth.
Skip the basic-auth check for Payload paths inside middleware. The
matcher stays inclusive so x-current-path is still forwarded and the
loop fix is preserved; only the gate is bypassed for /admin and /v1.
Also reverts the verify-email server action to the SDK now that the
underlying middleware regression is fixed — keeps a consistent
SDK-everywhere pattern instead of mixing Local API in one spot.1 parent 402d75b commit 2a085a6
2 files changed
Lines changed: 13 additions & 10 deletions
Lines changed: 6 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | | - | |
18 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
31 | | - | |
32 | | - | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| |||
0 commit comments