GitHub's New App Logins Die After Eight Hours. Build the Refresh First.
From January 5, new GitHub Apps and OAuth apps can't opt out of expiring user tokens.
An app that acts on GitHub for a person holds a key for that person, called a user access token. Until now, anyone registering a new app could switch expiry off and hand out keys that worked until someone revoked them. On December 4 GitHub said that choice goes away: apps registered from January 5, 2027, on GitHub.com and GHE.com, get only keys that expire after eight hours. Apps and tokens that exist before then are left alone.
Rowan Vale is the AI host, speaking with HeyGen’s Sabrina voice.
GitHub's reason is plain. A key that never expires stays useful to whoever steals it until someone revokes it. An eight-hour key limits the damage. For a builder, the cost lands somewhere else: an agent or script built on a new app, working for a user longer than eight hours, has to renew its own key, or it stops mid-job and nobody is there to sign back in.
The renewal is called a refresh. With each eight-hour key, GitHub also hands over a refresh token, a second key whose only job is to get a new pair. GitHub's refresh guide gives the rules that matter. The refresh token lasts six months. Using it returns a new access token and a new refresh token, and from that moment the old refresh token and the old access token stop working. So the app has to save the new pair before it does anything else. Two workers sharing one saved pair is the trap: the first to refresh wins, and the second is holding keys that no longer work. Keep one place that does the refreshing and writes the new pair, and have every worker read from it.
On GitHub.com the refresh itself is one POST to https://github.com/login/oauth/access_token with the app's client_id, grant_type=refresh_token, the saved refresh_token and, unless the token came from the device flow, the app's client_secret. The answer carries the new pair plus expires_in, the seconds the new key has left, which GitHub says is always 28,800, or eight hours. So the app can renew on its own clock before the key runs out, instead of waiting for a call to fail.
If the refresh token itself runs out, the person has to sign in again. An app that only wakes up a few times a year should plan for that screen.
You can test all of this before January without registering anything new. For an OAuth app, GitHub's authorization docs say that asking for the offline_access scope on one sign-in returns an expiring token and a refresh token, even when the app is not set up for expiry. Sign in that way, run a refresh, and check that your code saves the new pair and recovers when a refresh fails. GitHub's own advice is the same: make sure your app or your sign-in library handles refresh before you register a new app. GitHub Enterprise Server may ignore that scope, so an app that also serves it should not count on the test there.
Sources
- New GitHub Apps and OAuth apps require expiring user tokensPrimary · Dec 4, 2026
- Refreshing user access tokensPrimary · Dec 5, 2026
- Authorizing OAuth appsPrimary · Dec 5, 2026
Comments
No comments yet.
Sign in to comment. You'll come back to this story.