({ requestBody, timeout })
| 91 | }, |
| 92 | |
| 93 | async exchangeCodeForTokens({ requestBody, timeout }) { |
| 94 | // Noumena's authorization_code grant currently requires a form-encoded |
| 95 | // body even though refresh_token accepts JSON. |
| 96 | const response = await axios.post<OAuthTokenExchangeResponse>( |
| 97 | getOauthTokenUrl(), |
| 98 | new URLSearchParams( |
| 99 | Object.entries(requestBody).map(([key, value]) => [key, String(value)]), |
| 100 | ), |
| 101 | { |
| 102 | headers: { |
| 103 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 104 | }, |
| 105 | timeout, |
| 106 | }, |
| 107 | ) |
| 108 | return response.data |
| 109 | }, |
| 110 | |
| 111 | async refreshOAuthToken({ requestBody, timeout }) { |
| 112 | const response = await axios.post<OAuthTokenExchangeResponse>( |
nothing calls this directly
no test coverage detected