You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`go-githubauth` is a Go package that provides utilities for GitHub authentication, including generating and using GitHub App tokens and installation tokens.
9
9
10
+
**v2.0.0** introduces Go generics support for unified authentication with both numeric App IDs and alphanumeric Client IDs in a single, type-safe API.
11
+
10
12
## Features
11
13
12
14
`go-githubauth` package provides implementations of the `TokenSource` interface from the `golang.org/x/oauth2` package. This interface has a single method, Token, which returns an *oauth2.Token.
13
15
16
+
### v2.0.0 Features
17
+
18
+
-**🔥 Go Generics Support**: Single `NewApplicationTokenSource` function supports both `int64` App IDs and `string` Client IDs
19
+
-**🛡️ Type Safety**: Compile-time verification of identifier types through generic constraints
20
+
-**⚡ Type Inference**: Automatic type detection - no need to specify generic parameters explicitly
21
+
-**📖 Enhanced Documentation**: Official GitHub API references and comprehensive JWT details
22
+
23
+
### Core Capabilities
24
+
14
25
- Generate GitHub Application JWT [Generating a jwt for a github app](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app)
15
26
- Obtain GitHub App installation tokens [Authenticating as a GitHub App](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-token-generated-by-an-app)
27
+
- RS256-signed JWTs with proper clock drift protection
28
+
- Support for both legacy App IDs and modern Client IDs (recommended by GitHub)
29
+
30
+
### Requirements
16
31
17
-
This package is designed to be used with the `golang.org/x/oauth2` package, which provides support for OAuth2 authentication.
32
+
-**Go 1.18+** (required for generics support)
33
+
- This package is designed to be used with the `golang.org/x/oauth2` package
18
34
19
35
## Installation
20
36
@@ -26,7 +42,9 @@ go get -u github.com/jferrl/go-githubauth
26
42
27
43
## Usage
28
44
29
-
### Usage with [go-github](https://github.com/google/go-github) and [oauth2](golang.org/x/oauth2)
45
+
### Usage with [go-github](https://github.com/google/go-github) and [oauth2](golang.org/x/oauth2)
First of all you need to create a GitHub App and generate a private key.
136
+
First, create a GitHub App and generate a private key. To authenticate as a GitHub App, you need to generate a JWT. [Generating a JWT for a GitHub App](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app)
79
137
80
-
To authenticate as a GitHub App, you need to generate a JWT. [Generating a jwt for a github app](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app)
0 commit comments