GitHub announced on December 4, 2026 that GitHub Apps and OAuth apps registered from January 5, 2027 on GitHub.com and GHE.com must use expiring user access tokens. If your new coding agent acts on behalf of users, it needs to renew those eight-hour credentials to stay connected without repeated sign-ins. Already-issued tokens are unaffected.
The change removes the opt-out from expiration for new registrations; it does not introduce refresh tokens or require every existing integration to migrate. The practical work is to check your authentication library, save replacement credentials reliably and provide a reconnect path.
Check the registration date and GitHub host
Inventory each app’s registration date, host and authentication mode—not just whether a development instance works today. A practical consequence of the new-registration rule: a separately registered production app created after the deadline can require refresh even if an older development app does not.
GHE.com is included in the cloud rollout. GitHub Enterprise Server, the self-hosted product, is different: the OAuth documentation warns that a server version without expiring-token support may return neither expiry fields nor a refresh token. The December announcement does not set a Server enforcement date or specify a rollout hour for January 5.
The announcement introduces no price change or per-refresh charge. That is not a promise that hosting, agent model usage or other GitHub services are free.
Choose user or installation authentication deliberately
For a GitHub App, user authentication attributes work to a user and limits access by both the app’s and the user’s permissions. Installation authentication attributes work to the app and suits independent automation. Do not switch a user-driven task to installation authority merely to avoid refresh: GitHub warns that doing so can expose access the user should not have.
Installation tokens have their own one-hour lifetime and generation flow. SDK support for renewing those tokens does not establish that the same library handles user-token refresh. Check the exact authentication mode your integration uses.
If your project also deploys Claude through GitHub Actions, Claude Terraform authentication on GitHub Actions covers a separate workload-identity exchange. It is not a substitute for renewing GitHub user credentials.
Save both tokens after every refresh
An access token is the credential sent with API requests. A refresh token obtains its replacement without another user sign-in. Each successful refresh replaces both credentials; the old access token and refresh token stop working. Saving only the new access token loses the next renewal path.
For GitHub.com, the documented refresh request has this shape. This is a request outline, not runnable integration code:
POST https://github.com/login/oauth/access_token
client_id: YOUR_CLIENT_ID
grant_type: refresh_token
refresh_token: CURRENT_REFRESH_TOKEN
client_secret: YOUR_CLIENT_SECRET, unless the original token used device flowUse the client ID, not the GitHub App ID. Configure the appropriate host endpoint for GHE.com or Enterprise Server rather than copying the GitHub.com URL unchanged.
Persist access_token, refresh_token, expires_in and refresh_token_expires_in from the response with their receipt time, so expiry deadlines survive a restart. GitHub documents an eight-hour access lifetime and a six-month refresh lifetime; the OAuth reference specifies six months without use. Base renewal on returned expiry metadata, not a guessed calendar date.
Associate the pair with the correct host, app and user authorization. For web apps, GitHub recommends encrypted backend storage and restricted access. Keep credentials out of prompts, source files and logs. Cache usable tokens instead of refreshing on every API call.
Coordinate workers so they do not overwrite credentials
The replacement rule creates a concurrency problem: one worker can invalidate the token pair another worker still holds. The following is an engineering recommendation derived from that rule, not a locking design prescribed by GitHub:
Give one worker at a time permission to refresh a particular user authorization. After acquiring that permission, read the latest shared credential record again.
Refresh only when needed, using the saved expiry deadline. Allow a conservative margin for network delay and clock differences; no particular margin is mandated here.
Save the replacement pair and its expiry metadata consistently, with a version check that prevents a stale worker overwriting newer credentials. Make other workers discard stale cached copies.
A local database transaction cannot make GitHub’s token exchange and your database write one atomic operation. If the response is lost or saving fails, do not assume the old refresh token can be reused. Check whether a newer pair was saved; if no usable credentials can be recovered, require reauthorization rather than retrying indefinitely.
Credential recovery is also not permission to replay a comment, pull request or other external action blindly. Keep task completion records separate from token state; the guide to GitHub issue triggers and duplicate-agent-run checks explains that distinction.
Pilot renewal before relying on unattended runs
For an individual pilot sign-in, request offline_access. OAuth apps add it alongside their existing permission scopes. For GitHub Apps, it forces expiry without granting resource permissions. This lets an existing app trial renewal without first changing expiration for every new authorization.
Before enabling unattended work, check these behaviors in an isolated authorization:
The sign-in returns expiry fields and a refresh token on a supported host.
A first refresh saves the replacement pair, a second refresh uses it, and a restarted process reloads the current credentials.
Two workers reaching the renewal boundary do not lose or overwrite the replacement pair.
A lost response, failed save or unusable refresh credential leads to recovery or a clear reconnect prompt—not an endless retry loop.
For OAuth apps, an invalid or expired refresh token produces bad_refresh_token. Check for a newer shared record before treating a cached failure as final; otherwise, send the user through web or device authorization again. Refresh preserves the previous OAuth scopes and cannot expand access.
Use successful renewal and restart recovery—not just a successful first sign-in—as the readiness check for a newly registered agent app.
