I'm trying to generate an access token for my GitHub App via GitHub API.
I'm getting a 401 unauthorized response error:
expiration time' claim ('exp') is too far in the future
My code:
const now = Date.now()
const expiration = now + 60 * 10 // JWT expiration time (10 minute maximum)
const payload = {
iat: now
exp: expiration,
iss: appId
}
const jwt = jwtGenerator(payload, privatePem, { algorithm: "RS256" })
Github documentation - https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/