Skip to content

Feature Request: Streamlined Authentication Flow for gh auth switch and gh auth refresh #12190

Description

@Divyam-Kumar-Pandey

Describe the feature or problem you’d like to solve

I frequently use gh auth switch and gh auth refresh multiple times throughout the day. The current authentication flow requires manually copying the verification code and opening the authorization URL in a browser, which slows down the workflow and adds repeated friction.

Proposed solution

Enhance the authentication process by automatically copying the verification code to the clipboard and opening the required browser window. This improvement would significantly reduce manual steps, making the authentication experience smoother, faster, and more efficient.

Additional context

Image

Please refer to the attached screenshot for the current flow.

Activity

  1. github-actions commented on Nov 24, 2025

    @github-actions
    Contributor

    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 wanted Contributions 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.

  2. Divyam-Kumar-Pandey commented on Nov 24, 2025

    @Divyam-Kumar-Pandey
    Author

    @babakks If this proposal is accepted, I would like to volunteer to work on the implementation. Kindly let me know if the issue can be assigned to me.

  3. BagToad commented on Nov 24, 2025

    @BagToad
    Member

    Hey @Divyam-Kumar-Pandey we have a gh auth refresh -c option already to copy the OAuth code to clipboard - please let us know if that works for your use case ❤️

  4. andyfeller commented on Nov 24, 2025

    @andyfeller
    Contributor

    Hey @Divyam-Kumar-Pandey we have a gh auth refresh -c option already to copy the OAuth code to clipboard - please let us know if that works for your use case ❤️

    @BagToad : what are your thoughts about making -c, --clipboard on by default for gh auth login and gh auth refresh?

    I agree this should really address the concern raised. The GitHub Copilot CLI automatically copies its device code to the clipboard before pressing enter:

    Screenshot from GitHub Copilot CLI /login experience

    If users weren't copying and pasting it, then I'd be worried about overwriting what was in their copy buffer, however I think most everyone is copy and pasting rather than memorizing and entering it 🤷

  5. Divyam-Kumar-Pandey commented on Nov 24, 2025

    @Divyam-Kumar-Pandey
    Author

    @BagToad Thanks for pointing that out!

    The only remaining friction is that it doesn’t automatically open the browser. Also, since the user will almost always confirm the login. I’m not sure there’s much value in waiting for them to type y and press Enter to proceed. Automating those steps would make the flow even smoother.

  6. Divyam-Kumar-Pandey commented on Nov 24, 2025

    @Divyam-Kumar-Pandey
    Author

    @andyfeller Makes sense. I believe it would be more convenient if copying the code to the clipboard were enabled by default.

  7. BagToad commented on Nov 24, 2025

    @BagToad
    Member

    @BagToad : what are your thoughts about making -c, --clipboard on by default for gh auth login and gh auth refresh?

    I agree this should really address the concern raised. The GitHub Copilot CLI automatically copies its device code to the clipboard before pressing enter:

    @andyfeller I personally dislike this behavior in the context of gh and its established flows. I would rather gh only read and write a user's clipboard only when told as it is different behavior. I'd be happy to have a configuration option to enable this behavior, but replacing non-destructive behavior with a destructive behavior by default feels like the wrong decision.

    The copilot CLI affords itself the luxury of being a new product with new UX flows. Since gh has established flows that users are accustomed to, I don't like the idea of sliding in a data destructive action like writing to the clipboard where it was once absent.

    Edit: Some more thought to this - a major release for something like this would be unprecedented, but it does cross my mind as a way to excuse the change and get what is ultimately a more useful design out the door.

  8. BagToad commented on Nov 24, 2025

    @BagToad
    Member

    @BagToad Thanks for pointing that out!

    The only remaining friction is that it doesn’t automatically open the browser. Also, since the user will almost always confirm the login. I’m not sure there’s much value in waiting for them to type y and press Enter to proceed. Automating those steps would make the flow even smoother.

    @Divyam-Kumar-Pandey That makes sense, but I'd just note that we don't require a Y input, only an ENTER keypress. I would be on board with making -c immediately open the browser.

  9. added
    authrelated to tokens, authentication state, or oauth
    and removed on Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authrelated to tokens, authentication state, or oauthenhancementa request to improve CLIgh-authrelating to the gh auth command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions