This project is a very small Deno application that authenticates against the iRacing API and fetch the tracks.
There are only three functions: hashPassword, login and fetchData.
The login function uses a CookieJar to store the returned cookies, including the authtoken set during login.
This CookieJar is then passed to the fetchData function that handles the data request.
Important: This is only an example. If you're doing many requests against the iRacing API you should store the authentication data avoiding to re-authenticate with each request.
# install dependencies
$ deno install
# run (make sure you've enabled legacy read only authentication!)
# to avoid, that the command with your password is stored in the bash history, make sure that you add a leading space
$ deno run main.ts [email protected] MyPassWord
# run tests
$ deno test