Description
Describe the feature or problem you’d like to solve
The new expiring credentials are a welcome improvement. GitHub documents an eight-hour lifetime for the resulting OAuth access token, however, and I’d like the option to use a shorter lifetime.
A local script or tool can obtain the current bearer token using gh auth token. Depending on when it obtains the token, a copied token may remain usable for much of its eight-hour lifetime, with the permissions granted to the CLI credential. A 15- or 60-minute lifetime could reduce the exposure window for an access-token-only leak.
Proposed solution
Allow users or organizations to request a shorter, server-enforced access-token lifetime for GitHub CLI OAuth credentials, while continuing to use the refresh token for normal CLI operation.
Users could choose from a small set of lifetimes, or an organization could define an upper bound. The exact values and defaults could be determined by GitHub.
Shorter lifetimes would increase refresh frequency and could affect rate limits, concurrency, offline workflows, and tools that cache gh auth token output. They would reduce the useful lifetime of a stolen access token, but would not address theft of the refresh token or ongoing malicious code execution on the endpoint.
I understand the OAuth server determines the token’s actual expiration, and I could not find a documented way for gh to request a shorter lifetime today. Could the OAuth platform support this, and could gh expose it if available?
Additional context
A client-side decision to stop using a token earlier would not invalidate an already copied token on GitHub. Narrower scopes and repository access would further reduce impact, but are separate from this lifetime request.
- [GitHub OAuth: expiring access tokens](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#expiring-access-tokens)
- [GitHub CLI expiring credentials announcement](https://github.blog/changelog/2026-10-21-github-cli-opt-in-to-expiring-auto-refreshing-oauth-tokens/)
Activity
cli-triage commentedon Nov 6, 2026
GitHub CLI 2.103.3 supports requesting refreshable credentials with
gh auth login --expiring, but it does not offer a duration setting. The released help also says the request is only a preference and that issuance depends on the host and OAuth app configuration.This request therefore covers a remaining capability: allowing a user or organization to ask GitHub's OAuth service for a shorter, server-enforced access-token lifetime, then exposing that choice in
ghif the platform supports it. The existing short-lived token issues implemented refreshable credentials, not configurable access-token durations.Supporting reports
Duplicate analysis
Label reasoning
Investigation notes
Generated by issue triage.
github-actions commentedon Nov 9, 2026
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.