我正在尝试通过 GitHub API 为我的 GitHub 应用程序生成访问令牌。
我收到 401 未经授权的响应错误:
expiration time' claim ('exp') is too far in the future
我的代码:
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 文档 - https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/