{"id":15870906,"url":"https://github.com/int128/oauth2-github-app","last_synced_at":"2025-03-16T04:30:25.947Z","repository":{"id":38092080,"uuid":"338021871","full_name":"int128/oauth2-github-app","owner":"int128","description":"Go package for authenticating with GitHub App Installation token, interoperable with golang.org/x/oauth2 package","archived":false,"fork":false,"pushed_at":"2025-03-05T19:18:26.000Z","size":318,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-05T20:36:46.503Z","etag":null,"topics":["github-api","golang","oauth2"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/int128/oauth2-github-app","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/int128.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-11T12:24:26.000Z","updated_at":"2025-03-05T19:17:57.000Z","dependencies_parsed_at":"2023-11-28T03:27:44.120Z","dependency_job_id":"844197ca-59dc-4a91-931f-50dc012bd145","html_url":"https://github.com/int128/oauth2-github-app","commit_stats":{"total_commits":137,"total_committers":2,"mean_commits":68.5,"dds":"0.12408759124087587","last_synced_commit":"09261cda8226c8ae582ae64ef5f77d66cc159bc7"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Foauth2-github-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Foauth2-github-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Foauth2-github-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Foauth2-github-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/int128","download_url":"https://codeload.github.com/int128/oauth2-github-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801679,"owners_count":20350108,"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":["github-api","golang","oauth2"],"created_at":"2024-10-06T00:40:50.450Z","updated_at":"2025-03-16T04:30:25.675Z","avatar_url":"https://github.com/int128.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oauth2-github-app [![go](https://github.com/int128/oauth2-github-app/actions/workflows/go.yaml/badge.svg)](https://github.com/int128/oauth2-github-app/actions/workflows/go.yaml) [![Go Reference](https://pkg.go.dev/badge/github.com/int128/oauth2-github-app.svg)](https://pkg.go.dev/github.com/int128/oauth2-github-app)\n\nThis is a Go package for [authenticating with a GitHub App Installation](https://docs.github.com/en/developers/apps/authenticating-with-github-apps).\nIt is interoperable with `golang.org/x/oauth2` package.\n\n## Getting Started\n\n### Prerequisite\n\nSet up your GitHub App Installation.\n\n1. [Create a GitHub App](https://docs.github.com/en/developers/apps/creating-a-github-app)\n1. [Download a private key of the GitHub App](https://docs.github.com/en/developers/apps/authenticating-with-github-apps)\n1. [Install your GitHub App on your repository or organization](https://docs.github.com/en/developers/apps/installing-github-apps)\n\nThis package requires the following inputs:\n\n- Private Key file\n- App ID (number)\n- Installation ID (number)\n\n### Create a client\n\nTo create an OAuth2 client with GitHub App installation token,\n\n```go\nfunc run(ctx context.Context, appID, installationID, privateKeyFilename string) error {\n\tprivateKey, err := oauth2githubapp.LoadPrivateKey(privateKeyFilename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not load the private key: %w\", err)\n\t}\n\n\t// create a client\n\tcfg := oauth2githubapp.Config{\n\t\tPrivateKey:     privateKey,\n\t\tAppID:          appID,\n\t\tInstallationID: installationID,\n\t}\n\tclient := oauth2.NewClient(ctx, cfg.TokenSource(ctx))\n}\n```\n\nFor [`github.com/google/go-github`](https://github.com/google/go-github) package,\n\n```go\n\tcfg := oauth2githubapp.Config{\n\t\tPrivateKey:     privateKey,\n\t\tAppID:          appID,\n\t\tInstallationID: installationID,\n\t}\n\tclient := github.NewClient(oauth2.NewClient(ctx, cfg.TokenSource(ctx)))\n```\n\nFor [`github.com/shurcooL/githubv4`](https://github.com/shurcooL/githubv4) package,\n\n```go\n\tcfg := oauth2githubapp.Config{\n\t\tPrivateKey:     privateKey,\n\t\tAppID:          appID,\n\t\tInstallationID: installationID,\n\t}\n\tclient := githubv4.NewClient(oauth2.NewClient(ctx, cfg.TokenSource(ctx)))\n```\n\nSee also [example](example/main.go).\n\n## GitHub Enterprise\n\nTo set your GitHub Enterprise server,\n\n```go\n\tcfg := oauth2githubapp.Config{\n\t\tPrivateKey:     privateKey,\n\t\tAppID:          appID,\n\t\tInstallationID: installationID,\n\t\tBaseURL:        \"https://api.github.example.com\",\n\t}\n\tclient := oauth2.NewClient(ctx, cfg.TokenSource(ctx))\n```\n\n## Contribution\n\nThis is an open source software. Feel free to contribute to it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Foauth2-github-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fint128%2Foauth2-github-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Foauth2-github-app/lists"}