-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #670 from XeroAPI/OAS-version-update-6.3.0
OAS version update - 6.3.0
- Loading branch information
Showing
359 changed files
with
195,933 additions
and
40,853 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {Octokit} from "@octokit/rest"; | ||
import {createAppAuth} from "@octokit/auth-app" | ||
|
||
export const getAccessToken = async () => { | ||
|
||
const {GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY} = process.env | ||
|
||
const octoKitInstance = new Octokit({ | ||
authStrategy: createAppAuth, | ||
auth: { | ||
appId: GITHUB_APP_ID, | ||
privateKey: GITHUB_APP_PRIVATE_KEY | ||
} | ||
}); | ||
|
||
const {data: installations} = await octoKitInstance.rest.apps.listInstallations() | ||
|
||
if(!installations.length) { | ||
throw new Error("No Installations found for this github app") | ||
} | ||
|
||
const installationId = installations[0].id; | ||
|
||
const installationAccessToken = await octoKitInstance.rest.apps.createInstallationAccessToken({installation_id: installationId}) | ||
|
||
return installationAccessToken.data.token | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.