Skip to content

Commit d862636

Browse files
authored
"Issued at" time should allow for clock drift (#4156)
If `iat` is in the future from the server clock perspective GitHub will report an error. This can happen if the clock on the client system is significant out of sync with UTC and/or server time. Adjusting `iat` to an arbitrary 60 seconds in the past means the error will not occur in cases where the client system clock is only off by a few seconds, which is not uncommon.
1 parent 1dcb911 commit d862636

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

content/developers/apps/authenticating-with-github-apps.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ private_key = OpenSSL::PKey::RSA.new(private_pem)
7777
7878
# Generate the JWT
7979
payload = {
80-
# issued at time
81-
iat: Time.now.to_i,
80+
# issued at time, 60 seconds in the past to allow for clock drift
81+
iat: Time.now.to_i - 60,
8282
# JWT expiration time (10 minute maximum)
8383
exp: Time.now.to_i + (10 * 60),
8484
# {% data variables.product.prodname_github_app %}'s identifier

0 commit comments

Comments
 (0)