MCPcopy Index your code
hub / github.com/simstudioai/sim / fetchVantaWithAuth

Function fetchVantaWithAuth

apps/sim/tools/vanta/utils.ts:253–265  ·  view source on GitHub ↗
(
  tokenParams: VantaTokenParams,
  doFetch: (accessToken: string) => Promise<Response>
)

Source from the content-addressed store, hash-verified

251 * revoked the cached token — it retries once with a freshly exchanged token.
252 */
253export async function fetchVantaWithAuth(
254 tokenParams: VantaTokenParams,
255 doFetch: (accessToken: string) => Promise<Response>
256): Promise<Response> {
257 const accessToken = await getVantaAccessToken(tokenParams)
258 const response = await doFetch(accessToken)
259 if (response.status !== 401) {
260 return response
261 }
262
263 const freshToken = await getVantaAccessToken(tokenParams, { forceRefresh: true })
264 return doFetch(freshToken)
265}
266
267/**
268 * Builds a Vanta v1 API URL, appending only query parameters that have a

Callers 3

route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90

Calls 1

getVantaAccessTokenFunction · 0.85

Tested by

no test coverage detected