Skip to content
Discussion options

You must be logged in to vote

Yes — two different lifetimes are involved, and you’re caching the wrong one for too long:

The app JWT (signed with your private key, RS256) is valid for at most 10 minutes. It’s only used to talk about the app itself and to mint installation tokens.
The installation access token is valid for 1 hour. That’s the one you use for repo API calls, and it’s what’s expiring in your service.

So the fix is to treat installation tokens as short-lived credentials: cache them per installation with their expires_at, and mint a new one when they’re within a minute or two of expiry. Don’t store them at process start.

Minimal version with Octokit, which does the caching/refresh for you:

import { App } fr…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by komalpal1031
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apps API and Webhooks Discussions related to GitHub's APIs or Webhooks Question Ask and answer questions about GitHub features and usage Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates Apps Discussions around GitHub Marketplace and Apps
2 participants