Skip to content

gh auth login doesn't poll for success unless you press enter to open web #12925

@david-crespo

Description

@david-crespo

Describe the bug

I ran gh auth login and when I got to the web login step, I cmd+clicked the link (ghostty) to open it in my browser and enter the code. After a successful login on the web, the CLI never changed state to reflect my successful login. Eventually it occurred to me to do what it actually says and try pressing Enter to open the browser for the login step, and that time it worked.

$ gh auth login
? Where do you use GitHub? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: XXXX-XXXX
Press Enter to open https://github.com/login/device in your browser...

To me this suggested the CLI doesn't poll for successful login until you press enter. I was able to confirm this by running GH_DEBUG=api gh auth login — if I press enter, I see the polling requests go through every 10 seconds or so. If I don't press enter, nothing happens.

Affected version

$ gh version
gh version 2.88.1 (2026-03-12)
https://github.com/cli/cli/releases/tag/v2.88.1

Expected vs actual behavior

I expect the login to work whether I click the link or press enter to open it. Maybe this is developer brain but I think of the Enter key as merely a shortcut to open the site, not as a load-bearing event in the login process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-authrelating to the gh auth command

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions