You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
blockedenhancementa request to improve CLIgh-authrelating to the gh auth commandneeds-triageneeds to be reviewedplatformProblems with the GitHub platform rather than the CLI client
Describe the feature or problem you’d like to solve
Currently, when using gh auth login with the OAuth flow, the generated authentication token is not tied to a specific device or session. All logins using the GitHub CLI (gh) for a given user account via OAuth share the same token, and revoking OAuth access removes access from all devices at once. There is no way to revoke access to just one specific device or CLI session when OAuth is used.
This creates challenges for security and access management, particularly in these scenarios:
If a device is lost, stolen, or decommissioned, users cannot revoke just that device's CLI access—they must revoke OAuth access for all devices.
Users lack visibility and control over which machines are authorized to use CLI via OAuth for their account.
Proposed solution
Implement per-device/session OAuth token management for GitHub CLI authentication.
Each gh auth login instance (on a new machine or user profile) should create a unique, device-tied OAuth token.
Show a list of all active OAuth device tokens in the GitHub UI under Developer Settings, including device name, creation date, and last used info.
Allow tokens to be individually revoked from the GitHub web UI, terminating CLI OAuth access for only the targeted device/session.
Optionally, allow users to name devices during gh auth login for easier identification.
Additional context
This would bring OAuth-based CLI access management in line with how many cloud platforms handle per-device/session tokens. It would make it easier for users to manage authorized CLI environments and respond quickly to security incidents without broad disruption.
Thank you for your issue! We have categorized it as a feature 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.
This issue touches a wide range of concepts/domains so apologies for my long comment. I'll try to organise it into a couple of sections.
Identical tokens
I understand from your explanation that you're observing identical tokens being generated for independent gh auth login calls. Please correct me if I'm wrong. But if that's what you're saying, I kind of have a strong opinion that OAuth, as a standard, would never allow such a thing for the reasons you've already mentioned. Also, I checked and can confirm that every gh auth login ends up in a different token regardless of the host machines on which you run the command.
So, can you please tell me more about your situation so that I can reproduce it on my end?
Managing tokens via gh
gh solely relies on the public GitHub API (REST and GraphQL). As I quickly checked I could find only one endpoint that can be used to revoke a given set of credentials (See here). This is too little to develop a decent set of gh commands out of it.
Improvements to the web GUI
These suggestions are out of the scope of gh. I have to check, but I guess admins of a GitHub Enterprise Server (GHES) or an Enterprise Organization are already provided with some web GUI tools to handle the revocation of tokens.
I might have not described the token very correctly in the original post. I am not sure if the OAuth tokens are exactly the same. What I meant is that I cannot find different device OAuth token management from the GitHub webpage.
Device management
The problem is, we cannot currently revoke the access for one particular device which is authenticated via gh auth login using https and OAuth. I would like to see this function in case of for example stolen laptop.
We can now only revoke the OAuth access to the entire GitHub CLI, which means I have to re-enable the CLI OAuth and re-login to all other devices.
I actually followed up with the stakeholders through internal comms to see if there's any ongoing/planned effort. Unfortunately, as of now, there are no such plans.
So, I'm going to mark this issue as
blocked
and
platformProblems with the GitHub platform rather than the CLI client
to indicate that this is pending on platform changes.
For the team: Although this is not necessarily related to gh auth commands, but I stamped the
gh-authrelating to the gh auth command
label to add more visibility to this issue when we're looking for auth related issues.
blockedenhancementa request to improve CLIgh-authrelating to the gh auth commandneeds-triageneeds to be reviewedplatformProblems with the GitHub platform rather than the CLI client
Activity
github-actions commentedon Jul 31, 2025
Thank you for your issue! We have categorized it as a feature 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.
babakks commentedon Aug 1, 2025
Thanks for submitting the issue, @TonyXiang8787! 🙏
This issue touches a wide range of concepts/domains so apologies for my long comment. I'll try to organise it into a couple of sections.
Identical tokens
I understand from your explanation that you're observing identical tokens being generated for independent
gh auth logincalls. Please correct me if I'm wrong. But if that's what you're saying, I kind of have a strong opinion that OAuth, as a standard, would never allow such a thing for the reasons you've already mentioned. Also, I checked and can confirm that everygh auth loginends up in a different token regardless of the host machines on which you run the command.So, can you please tell me more about your situation so that I can reproduce it on my end?
Managing tokens via
ghghsolely relies on the public GitHub API (REST and GraphQL). As I quickly checked I could find only one endpoint that can be used to revoke a given set of credentials (See here). This is too little to develop a decent set ofghcommands out of it.Improvements to the web GUI
These suggestions are out of the scope of
gh. I have to check, but I guess admins of a GitHub Enterprise Server (GHES) or an Enterprise Organization are already provided with some web GUI tools to handle the revocation of tokens.TonyXiang8787 commentedon Aug 6, 2025
Dear @babakks,
Thank you very much for your extensive reply.
Identical tokens
I might have not described the token very correctly in the original post. I am not sure if the OAuth tokens are exactly the same. What I meant is that I cannot find different device OAuth token management from the GitHub webpage.
Device management
The problem is, we cannot currently revoke the access for one particular device which is authenticated via
gh auth loginusinghttpsandOAuth. I would like to see this function in case of for example stolen laptop.We can now only revoke the OAuth access to the entire
GitHub CLI, which means I have to re-enable the CLI OAuth and re-login to all other devices.babakks commentedon Aug 6, 2025
No worries, @TonyXiang8787! 🍻
I actually followed up with the stakeholders through internal comms to see if there's any ongoing/planned effort. Unfortunately, as of now, there are no such plans.
So, I'm going to mark this issue as blocked and platformProblems with the GitHub platform rather than the CLI client
to indicate that this is pending on platform changes.
For the team: Although this is not necessarily related torelating to the gh auth command
label to add more visibility to this issue when we're looking for auth related issues.
gh authcommands, but I stamped the gh-auth