Authenticating using a personal access token is straight forward, so it’s already built into https://github.com/octokit/core.js and all libraries that are built upon it.
Sending the above request would look like this in the browser
<script type="module"> import { Octokit } from "https://cdn.pika.dev/@octokit/core"; const octokit = new Octokit({ auth: "d64761df071c2bf517ceb063b279432ed2f89c62" }); octokit.request('GET /repos/:owner/:repo/releases/latest', { owner: "octokit", repo: "core.js" }).then(response => console.log(response.data)) </script>
And like this in Node.js
const { Octokit } = require('@octokit/rest') const octokit = new Octokit({ auth: "d64761df071c2bf517ceb063b279432ed2f89c62" }); octokit.request('GET /repos/:owner/:repo/releases/latest', { owner: "octokit", repo: "core.js" }).then(response => console.log(response.data))