Skip to content

auth refresh makes it easy to authorise the wrong account in the browser #14841

Open

Description

@williammartin

Describe the feature or problem you’d like to solve

Currently, gh auth refresh only refreshes the active account. The help text says that to refresh another account you have to gh auth switch to it first, and then switch back when you are done.

That part is fine, but the browser has no idea which account gh is refreshing. When I am signed in to multiple accounts on github.com, the device flow page shows a multi account interstitial asking which account to continue with. Nothing on that page tells me which account gh expects, so it is easy to pick the wrong one.

If I do, I only find out at the very end, when gh rejects the token here:

return fmt.Errorf("error refreshing credentials for %s, received credentials for %s, did you use the correct account in the browser?", activeUser, result.Username)

At that point the device code has been used, so the only option is to run the whole flow again and hope I click the right account this time.

Proposed solution

I don't think gh can fix this on its own, because the account picker lives on the OAuth page. OpenID Connect defines a login_hint parameter for exactly this, so the client can tell the server which account it expects.

Acceptance Criteria

Given I am signed in to github.com in my browser as monalisa and hubot
And Given monalisa is the active account in gh auth status
When I run gh auth refresh and open the verification URL
Then the browser only offers to continue as monalisa

Activity

  1. cli-triage commented on Nov 9, 2026

    @cli-triage

    Current release 2.103.3 does not provide a way to tell the browser which GitHub account should complete gh auth refresh. The command refreshes the active account, starts the shared OAuth device flow without an account hint, and only checks the returned username after authorization. This means the requested behavior is not currently supported. The request is clear and actionable, though the exact server parameter may differ from OpenID Connect's login_hint because this path uses OAuth device authorization. The desired account-selection outcome remains a valid enhancement.

    Supporting reports

    Generated by issue triage.

  2. added
    enhancement
    gh-auth
    on Nov 9, 2026
  3. github-actions commented on Nov 9, 2026

    @github-actions
    Contributor

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

  4. removed
    needs-triage
    on Nov 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

    enhancementgh-auth

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions