gidgethub / gidgethub

An async GitHub API library for Python

Home Page:https://gidgethub.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide a way to retrieve an org's GitHub App Installation

Mariatta opened this issue · comments

For authenticating as a GitHub App, we need to have the app's installation_id.
https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-app#generating-an-installation-access-token

The installation_id is passed to the webhook payload. But it can also be retrieved through REST API, for apps that doesn't use webhooks. (i.e background processes).

The installation id can be retrieved through these endpoints, depending on the org and the user:
GET /users/{username}/installation
GET /repos/{owner}/{repo}/installation
GET /orgs/{org}/installation
GET /app/installations

These endpoints need to be accessed using jwt, similar to how we handle get_installation_access_token. So it would be great if gidgethub can provide this abstraction too.

https://gidgethub.readthedocs.io/en/latest/apps.html#gidgethub.apps.get_installation_access_token