Skip to content

Instantly share code, notes, and snippets.

@billmetangmo
Created March 28, 2023 10:04
Show Gist options
  • Select an option

  • Save billmetangmo/0ad1f992851db6d7c633e36c8174c3fc to your computer and use it in GitHub Desktop.

Select an option

Save billmetangmo/0ad1f992851db6d7c633e36c8174c3fc to your computer and use it in GitHub Desktop.
import githubAppJwt from 'universal-github-app-jwt';
import { request } from "@octokit/request";
const APPID = "XXXXXX"
// Replace with the path to your GitHub App's private key file
const PRIVATE_KEY = `YYYYYYYYYYYYYYY`;
try {
const { token, expiration } = await githubAppJwt({
id: APPID,
privateKey: PRIVATE_KEY,
});
response = await request("GET /repos/fabiolatagne97/tp-2-wu_tagne/languages", {
headers: {
authorization: `bearer ${token}`,
},
});
console.log(response);
console.log(token, APPID, expiration);
} catch (error) {
console.error('Error generating JWT:', error);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment