Commit d9b7a9a
authored
Improve: auth provider check before auth flow (#195)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Gate all auth actions behind a Supabase auth health check and update
tests to mock the health endpoint.
>
> - **Backend**
> - Add `checkAuthProviderHealth()` in `src/server/auth/auth-actions.ts`
to call `GET /auth/v1/health` with timeout and caching; returns
`response.ok`.
> - Introduce `AUTH_PROVIDER_ERROR_MESSAGE` and use
`encodedRedirect('error', ...)` when provider is unhealthy.
> - Apply health pre-check to `signInWithOAuthAction`, `signUpAction`,
`signInAction`, and `forgotPasswordAction` (preserving `returnTo` when
applicable).
> - **Tests**
> - In `src/__test__/integration/auth.test.ts`, mock global `fetch` for
the health check and reset per test; remove redundant
`vi.resetAllMocks()` in `afterEach`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
17596e6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 32445cf commit d9b7a9a
File tree
2 files changed
+76
-1
lines changed- src
- __test__/integration
- server/auth
2 files changed
+76
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
80 | | - | |
81 | 92 | | |
82 | 93 | | |
83 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
21 | 43 | | |
22 | 44 | | |
23 | 45 | | |
| |||
29 | 51 | | |
30 | 52 | | |
31 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
32 | 65 | | |
33 | 66 | | |
34 | 67 | | |
| |||
86 | 119 | | |
87 | 120 | | |
88 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
89 | 133 | | |
90 | 134 | | |
91 | 135 | | |
| |||
147 | 191 | | |
148 | 192 | | |
149 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
150 | 205 | | |
151 | 206 | | |
152 | 207 | | |
| |||
191 | 246 | | |
192 | 247 | | |
193 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
194 | 258 | | |
195 | 259 | | |
196 | 260 | | |
| |||
0 commit comments