octokit/app.js

Using self signed certificate with getInstallationAccessToken

b4nst opened this issue · 2 comments

b4nst commented

When using with GitHub Enterprise behind a self signed certificate, how can I pass a custom agent to getInstallationAccessToken as I can do with new Octokit({agent}) ?

gr2m commented

This should be possible with the new @octokit/auth-app.js, I will deprecate this module soon in favor of @octokit/auth-app.js.

@octokit/auth-app.js accepts a request option to which you can pass in the octokit.request method from your configured Octokit client: https://github.com/octokit/auth-app.js/#createappauthoptions

Does that work for you?

b4nst commented

Yep that should work for me, because in the meantime I used octokit.request (with a proper configured https.Agent) and reforged the request found here :

.request({
method: "POST",
url: "/app/installations/:installation_id/access_tokens",
installation_id: installationId,
headers: {
accept: "application/vnd.github.machine-man-preview+json",
// TODO: cache the installation token if it's been less than 60 minutes
authorization: `bearer ${getSignedJsonWebToken(state)}`
},
repository_ids: repositoryIds,
permissions
})

and this worked. Thank you for pointing me the new module.