Replies: 2 comments 1 reply
-
|
Probot exports a middleware that is compatible with Express: Does that work for you? |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
I believe this is the most efficiant way I can find: import {ProbotOctokit} from "probot";
import { readEnvOptions } from "probot/lib/bin/read-env-options";
const { createAppAuth } = require("@octokit/auth-app");
// a client to get installation id
const auth = createAppAuth({
appId: probotOptions.appId,
privateKey: probotOptions.privateKey,
baseUrl: probotOptions.baseUrl,
})
const appAuthentication = await auth({
type: "app"
})
const listInstallClient = new ProbotOctokit({
auth: appAuthentication,
baseUrl: probotOptions.baseUrl,
})
const installationID = await listInstallClient.apps.getRepoInstallation({owner: "qizhicheng", repo: "test-repo"})
// get real operate client using installation id
const operateClient = new ProbotOctokit({
authStrategy: createAppAuth,
auth: {
appId: probotOptions.appId,
privateKey: probotOptions.privateKey,
baseUrl: probotOptions.baseUrl,
installationId: installationID.data.id
},
baseUrl: probotOptions.baseUrl,
})
await operateClient.issues.create({owner: "test", repo: "test", title: "test",}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I can get Octokit easily with
context.octokit, but there's no context in custom express route, what is the most efficient way to get an authenticated client?I tried
but no luck , saying
[@octokit/auth-app] installationId option is required for installation authentication.Beta Was this translation helpful? Give feedback.
All reactions