Skip to content

Commit

Permalink
fix 'Expiration time' claim ('exp') is too far in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Oct 2, 2021
1 parent 6ce4a61 commit b47f995
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions provider/github-app-token/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ func decodePrivateKey(privateKey []byte) (*rsa.PrivateKey, error) {
// generate JSON Web Token for authentication the app
// https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app
func (c *Client) generateJWT() (string, error) {
now := time.Now()
unix := now.Unix()
unix := time.Now().Unix()
token := jwt.NewWithClaims(jwt.SigningMethodRS256, jwt.MapClaims{
"nbf": unix - 60,
// issued at time, 60 seconds in the past to allow for clock drift
"iat": unix - 60,
// JWT expiration time (10 minute maximum)
"exp": unix + (10 * 60),
"exp": unix + (5 * 60),
// GitHub App's identifier
"iss": strconv.FormatUint(c.appID, 10),
})
Expand Down

0 comments on commit b47f995

Please sign in to comment.