Setup and teardown scripts can be used to execute arbitrary JavaScript/TypeScript code before and/or after an API check. Both script types have access to all environment variables, runtime objects like request and response and popular npm packages like moment, axios and lodash. To get the most power out of API checks with setup and teardown scripts, we advise using the Checkly CLI. However, you can also use them via our web UI| www.checklyhq.com
Here are some examples on how to address common authentication use cases with setup scripts. Using Vercel deployment protection? Read this section on how to make this work with Checkly. Fetch an external token TypeScript import axios from 'axios' // use 'await' on an axios HTTP get to fetch a token from a location const { data } = await axios.get('https://example.com/api/token') // add the token as a query parameters request.queryParameters['token'] = data.token JavaScript const axios = requi...| www.checklyhq.com