New GitHub Apps and OAuth apps must use expiring user tokens from 5 January 2027
GitHub is removing the option to opt out of token expiration for newly registered apps. Access tokens will last eight hours, renewed with a single-use refresh token.
On this page
GitHub announced on 4 December 2026 that new GitHub Apps and OAuth apps will soon have to use expiring user access tokens. From 5 January 2027, anyone registering a new app on GitHub.com or GHE.com will no longer be able to turn token expiration off.
If you or your agency build anything that lets people sign in with GitHub, or that acts on a person's repositories on their behalf, this affects how that code handles tokens.
What is changing
Expiring tokens are already the default for new apps. Until now, a developer could opt out during registration and get user tokens that never expire. GitHub is removing that option.
GitHub's reason is simple. A token that never expires stays valid until someone revokes it, so a leaked token can be misused for as long as nobody notices. A token that expires limits that window.
The change applies only to apps registered on or after 5 January 2027. GitHub says tokens issued before then are not affected.
How expiring tokens work
GitHub's documentation sets out the lifetimes:
- The user access token expires after eight hours. For a GitHub App, it starts with
ghu_. - The refresh token lasts six months. For a GitHub App, it starts with
ghr_. For OAuth apps, the docs say it expires after six months without use.
When the access token runs out, the app sends the refresh token to POST https://github.com/login/oauth/access_token with its client ID, its client secret (unless the token came from the device flow), grant_type=refresh_token and the refresh token itself. GitHub answers with a new access token and a new refresh token.
Each refresh token works once. GitHub's docs say that once you use a refresh token, both it and the old access token stop working. Your app must save the new refresh token from every response, or it will lose access at the next refresh.
If a refresh token itself expires, there is no way to refresh. The person has to sign in again through the web application flow or the device flow.
Existing apps
GitHub's announcement does not ask existing apps to change anything. It does recommend expiring tokens, and the docs explain how to switch:
- GitHub Apps: in Developer settings, edit the app, open Optional features and opt in to "User-to-server token expiration".
- OAuth apps: update the app to use refresh tokens first, then enable token expiration in its optional features.
Turning expiration on does not change tokens that were already issued. They keep working without expiring. GitHub's docs say you can delete them through the API or have people sign in again to get an expiring token.
To test the refresh flow before switching a whole app over, both kinds of app can request the offline_access scope for a single sign-in. That one person then gets an expiring access token and a refresh token, even if the app is not set up for expiration.
What it means for your site
- List your GitHub integrations. Note any site, client portal, internal tool or deploy script that signs people in with GitHub or calls GitHub as a user.
- Check your sign-in library. Before registering a new app after 5 January 2027, GitHub asks you to confirm that the app, or the authentication library it uses, supports the refresh token flow.
- Store the newest refresh token every time. The most common failure with single-use refresh tokens is keeping the old one. Write the new pair back to storage as soon as it arrives.
- Plan for a fresh sign-in. Refresh tokens run out after six months, so your app needs a clear path back to the sign-in screen rather than a silent failure.
- Consider opting in now. Existing apps are not forced to change, but an eight-hour token limits the damage if one leaks from logs, a browser or a shared machine.