Created
March 28, 2023 10:04
-
-
Save billmetangmo/0ad1f992851db6d7c633e36c8174c3fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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