{"id":15020787,"url":"https://github.com/electron/github-app-auth","last_synced_at":"2025-07-19T05:07:05.425Z","repository":{"id":40469466,"uuid":"489142849","full_name":"electron/github-app-auth","owner":"electron","description":"Gets an auth token for a repo via a GitHub app installation","archived":false,"fork":false,"pushed_at":"2025-05-09T09:23:14.000Z","size":205,"stargazers_count":16,"open_issues_count":0,"forks_count":6,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-13T09:32:22.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-05-05T22:26:31.000Z","updated_at":"2025-05-28T06:44:36.000Z","dependencies_parsed_at":"2024-01-23T17:35:28.398Z","dependency_job_id":"f1856d05-8eed-42db-8928-8eb5189a8271","html_url":"https://github.com/electron/github-app-auth","commit_stats":{"total_commits":39,"total_committers":9,"mean_commits":4.333333333333333,"dds":0.7692307692307692,"last_synced_commit":"0475e0ef69414fc2066562cae111acd2989c81f5"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/electron/github-app-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fgithub-app-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fgithub-app-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fgithub-app-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fgithub-app-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electron","download_url":"https://codeload.github.com/electron/github-app-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fgithub-app-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265659566,"owners_count":23806953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:55:38.128Z","updated_at":"2025-07-19T05:07:05.401Z","avatar_url":"https://github.com/electron.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @electron/github-app-auth\n\n\u003e Gets an auth token for a repo via a GitHub app installation\n\n[![Test](https://github.com/electron/github-app-auth/actions/workflows/test.yml/badge.svg)](https://github.com/electron/github-app-auth/actions/workflows/test.yml)\n[![npm version](https://img.shields.io/npm/v/@electron/github-app-auth.svg)](https://npmjs.org/package/@electron/github-app-auth)\n\n## Usage\n\n### Generating Credentials\n\nIn order to simply credential management `@electron/github-app-auth` contains\na CLI tool to generate a \"credential bundle\" that contains the requisite\ninformation to generate tokens.  You need both a private key for your\napplication and the application ID.\n\n* You can find your app's ID on the settings page for your GitHub App.\n* To download your app's private key, see [Managing private keys for GitHub Apps](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/managing-private-keys-for-github-apps).\n\n```bash\nnpx @electron/github-app-auth --cert=my-private.key.pem --app-id=12345\n```\n\nThis command will output a base64 encoded blob which you should store in your\nservices secret storage (normally accessed via an environment variable).  Below\nwe will use `MY_GITHUB_APP_CREDS` as the environment variable.\n\n### With `@octokit/rest`\n\n```typescript\nimport { appCredentialsFromString, getAuthOptionsForRepo } from '@electron/github-app-auth';\nimport { Octokit } from '@octokit/rest';\n\nconst creds = appCredentialsFromString(process.env.MY_GITHUB_APP_CREDS);\nconst authOpts = await getAuthOptionsForRepo({\n  owner: 'electron',\n  name: 'electron'\n}, creds)\nconst octo = new Octokit({\n  ...authOpts,\n});\n\n// octo is now a valid octokit instance\n```\n\n### With raw tokens\n\n```typescript\nimport { appCredentialsFromString, getTokenForRepo } from '@electron/github-app-auth';\nimport { Octokit } from '@octokit/rest';\n\nconst creds = appCredentialsFromString(process.env.MY_GITHUB_APP_CREDS);\nconst token = await getTokenForRepo({\n  owner: 'electron',\n  name: 'electron'\n}, creds)\n\n// token is now a valid github auth token\n```\n\n#### With raw tokens on the CLI\n\n```bash\ngh_token=$(npx @electron/github-app-auth --creds=$MY_GITHUB_APP_CREDS --owner=electron --repo=electron)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron%2Fgithub-app-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectron%2Fgithub-app-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron%2Fgithub-app-auth/lists"}