Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

[Bug] Expired token unable to refresh #68

Open

Description

@bguedel
2021-07-29 19:44:31.615  INFO [my-bot,1efb3e9c675e3506,1efb3e9c675e3506] 1 --- [nio-8080-exec-7] c.s.github.v3.clients.GitHubClient       : Github token for installation 1234 is either expired or null. Trying to get a new one.
--
2021-07-29 19:44:31.615  INFO [my-bot,1efb3e9c675e3506,1efb3e9c675e3506] 1 --- [nio-8080-exec-7] c.s.github.v3.clients.GitHubClient       : Got JWT Token. Now getting Github access_token for installation 1234
2021-07-29 19:44:31.619 ERROR [my-bot,a1558e2c87f905cd,a1558e2c87f905cd] 1 --- [nio-8080-exec-5] c.comp.path.WebhookErrorHandler  : error processing request: (Could not generate access token for github app)
java.lang.RuntimeException: Could not generate access token for github app
...
Caused by: java.lang.Exception: Got non-2xx status 401 when getting an access token from GitHub: Unauthorized
    at com.spotify.github.v3.clients.GitHubClient.generateInstallationToken(GitHubClient.java:607) ~[github-client-0.0.25.jar:0.0.25]
    at com.spotify.github.v3.clients.GitHubClient.getInstallationToken(GitHubClient.java:581) ~[github-client-0.0.25.jar:0.0.25]
    at com.spotify.github.v3.clients.GitHubClient.getAuthorizationHeader(GitHubClient.java:560) ~[github-client-0.0.25.jar:0.0.25]

on restart of the application; everything works fine.

Activity

  1. bguedel commented on Aug 12, 2021

    @bguedel
    Author

    Ill keep an eye on this. I think #70 might have fixed this? This error often happens after the connection leaked issue happens.

  2. bguedel commented on Aug 13, 2021

    @bguedel
    Author

    #70 did NOT fix this. Still seeing it.

    doesnt happen on every request. so dont really know what it could be.

  3. bguedel commented on Aug 16, 2021

    @bguedel
    Author

    Here are my thoughts

    https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app

    # Generate the JWT
    payload = {
      # issued at time, 60 seconds in the past to allow for clock drift
      iat: Time.now.to_i - 60,
    

    however in this code we see

    so i am wondering if the fix is simply to remove 60 seconds.

  4. added a commit that references this issue on Aug 17, 2021
    2c53bf2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions