(url: string)
| 145 | }) |
| 146 | |
| 147 | async function runProtectedRequest(url: string): Promise<{ ok: true }> { |
| 148 | return await withOAuth401Retry(async () => { |
| 149 | const authHeaders = getAuthHeaders() |
| 150 | if (authHeaders.error) { |
| 151 | throw new Error(`Failed to get auth headers: ${authHeaders.error}`) |
| 152 | } |
| 153 | const response = await axios.get<{ ok: true }>(url, { |
| 154 | headers: authHeaders.headers, |
| 155 | }) |
| 156 | return response.data |
| 157 | }, { |
| 158 | also403Revoked: true, |
| 159 | }) |
| 160 | } |
| 161 | |
| 162 | describe('withOAuth401Retry managed auth end-to-end', () => { |
| 163 | it('re-authenticates a protected request after a 401 and succeeds on retry', async () => { |
no test coverage detected