A credential copied to unblock a script can remain usable long after that task ends. GitHub announced an opt-in preview of expiring OAuth tokens in its CLI on October 21, aiming to shorten that exposure without constant manual sign-ins.
The practical question is not just whether access expires. It is which component handles renewal, and what happens when another tool holds an old copy.
An explicit choice at sign-in
GitHub says gh auth login --expiring is available from CLI 2.103.0. The client refreshes access automatically and gh auth status reports its state. For Git over HTTPS, the company recommends setting up its credential helper with gh auth setup-git.
The official announcement warns that scripts capturing gh auth token once may retain an expired value. This is an opt-in path, not an automatic conversion of every existing secret.
Find copies before enabling it
Our recommendation is to identify how tools obtain their credential and how long they keep it. An interactive terminal, extension and job running several hours later may share an assumption that no longer holds.
Describe the intended journey: which tool requests access, which one can renew it and which simply consumes the result. That separates permission problems from lifetime problems when something fails.
Never paste an actual token into a support ticket to demonstrate the failure. Keep the error and operational context, not the secret. A debugging process should not create a new exposure while trying to explain an old one.
Test renewal rather than only login
We suggest starting on a non-critical workstation with a read-only operation. Observe the initial sign-in and a later session. The aim is to understand the mechanism you intend to rely on every day.
Consider failure too: what does the user see and how do they regain normal access? Better expiration handling should not end with someone bypassing it through a permanent token stored in a file.
Keep the test within authorised identities and repositories. Evaluating renewal does not require granting additional permissions.
A shorter lifetime is not complete workstation protection
Our assessment is that expiration makes an isolated copied access token less useful over time. It does not justify neglecting the machine or other stored credentials. The renewal mechanism itself still needs protection.
This complements finer GitHub App permissions. Scope and lifetime are different dimensions of access. Improving both can clarify security, provided scripts stop treating every token as an everlasting value.
Cover: generated illustration, not a GitHub CLI screenshot.




Join the discussion
Comments
Loading comments…