GitHub expiring user tokens become mandatory for new apps next month. Starting January 5, 2027, every newly registered GitHub App and OAuth app will get user access tokens that expire after eight hours, with no opt-out. Tokens issued before then aren’t affected.
Updated December 5, 2026
Key Takeaways
- New GitHub Apps and OAuth apps registered from Jan. 5, 2027 can’t opt out of expiring user tokens.
- User tokens last eight hours; refresh tokens last six months.
- Refresh tokens rotate and are single-use, so concurrent refreshes cause bad_refresh_token errors.
- Apps supporting GitHub Enterprise Server must not assume a refresh token is returned.
The policy is simple. The engineering isn’t. Refresh tokens on GitHub rotate and work only once, so the first time two workers refresh the same user at the same moment, someone gets locked out. That is the bug to fix before you register your next app.
GitHub Expiring User Tokens: What Changed
According to the GitHub changelog, expiring tokens were already the default, but developers could opt out at registration and issue tokens that never expired. GitHub’s reason for removing that choice: a non-expiring token stays valid until it’s revoked, so a leaked token can be used indefinitely.
The change covers GitHub.com and GHE.com. GitHub’s advice is to make sure your app or authentication SDK supports the refresh flow before you register it.
| Token | Lifetime |
|---|---|
| Installation access token | 1 hour |
| Expiring user access token | 8 hours (expires_in 28800) |
| Refresh token | 6 months (refresh_token_expires_in 15897600) |
Those values come from GitHub’s refresh documentation and its GitHub App best practices.
Why Refresh Token Rotation Breaks Apps
GitHub’s docs state the rule plainly: once you use a refresh token, that refresh token and the old user access token will no longer work. That design follows the IETF’s OAuth 2.0 Security Best Current Practice (RFC 9700), which says refresh tokens for public clients must be sender-constrained or use refresh token rotation.
Integration vendor Nango lists the most common cause of GitHub’s bad_refresh_token error as refreshing successfully but not storing the new refresh token. The second is a race. Because refresh tokens rotate, “they are effectively single-use.” If worker A refreshes and worker B tries the stale token a moment later, B fails.
Nango says the failure can halt background syncs, user-triggered actions and webhook retries until the root cause is fixed. GitHub’s OAuth documentation says a bad_refresh_token means sending the user back through the web or device flow.
Build Checklist Before January 5
- Persist every rotated token. Write the access token, refresh token and expiry atomically, as Nango recommends.
- Make refresh single-flight. One refresh per user connection at a time, with other workers waiting for the result.
- Refresh on a schedule. Keep refresh tokens active so they don’t age out silently after six months.
- Handle failure cleanly. Nango says two bad_refresh_token errors in a row mean the token is almost certainly gone. Mark the connection for re-auth.
- Check the response. GitHub says to look for the expires_in field to confirm you received an expiring token.
- Store tokens apart. GitHub suggests storing refresh tokens separately from active access tokens.
Testing and Enterprise Server Caveats
You can test now. Requesting the offline_access scope gets an expiring token and refresh token for one sign-in, even if your app isn’t configured for expiring tokens.
Apps that also support GitHub Enterprise Server need a fallback. GitHub warns that offline_access may have no effect there because the instance may not yet support expiring tokens, so your app should not assume a refresh token is always returned.
What Existing Apps Should Do
Existing apps keep working, but turning on expiration later won’t fix old tokens. GitHub says pre-existing user tokens will not expire if you re-enable expiration after users signed in. You’d need to delete them or have users re-authenticate.
The deadline only touches new registrations, but the refresh logic is the same either way. Building it once now means your next app ships without a lockout bug. For related hardening, see our GitHub OAuth redirect changes.
Frequently asked questions
Does the change affect existing GitHub apps?
No. It applies to apps registered from January 5, 2027. Tokens issued before then aren’t affected.
How long do GitHub user tokens last?
Expiring user access tokens last eight hours and refresh tokens six months.
What causes bad_refresh_token?
Commonly a rotated refresh token that wasn’t saved, or two workers refreshing at once. Expiry or revocation also cause it.
How can I test expiring tokens now?
Request the offline_access scope during sign-in to get an expiring token and refresh token for that authorization.