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
{{ message }}
Repository navigation
gh auth login --with-token: provide clear, non-echoing token input when stdin is a terminal #14597
There is no prompt or explanation of how to submit the token. The command displays nothing. I pasted my token and pressed Enter, but nothing happened. It took checking the source code to understand that the command waits for EOF, which requires Ctrl+D on macOS. There is no indication of this in the terminal, so it looks like the login has hung.
The token is displayed in plain text. Pasting it leaves the full credential visible on screen and in terminal scrollback. I expected hidden input, like a password prompt.
The documentation shows file redirection, but running the command directly in a terminal provides no guidance about how to proceed.
Proposed solution
When stdin is a terminal, show an explicit prompt, hide the token by disabling terminal echo, and let Enter submit it.
GitHub CLI already has an AuthToken() prompter for hidden/masked input, which could be reused here. The intended behavior is like Go’s term.ReadPassword from golang.org/x/term or Python’s getpass.getpass: read the credential without displaying it. Keep existing behavior for pipes and file redirection.
If --with-token is intended exclusively for non-interactive input, immediately explain that and direct users to gh auth login → Paste an authentication token, instead of silently waiting.
Additional context
Reproduced with a dummy token on macOS 27.0.1 using gh 2.100.0.
Related: #9789, which covers the silent wait. This report also highlights the visible credential and the need for clear guidance during token entry.
Thanks for the detailed report. This looks like the same underlying root cause as #9789: when --with-token is set, gh auth login calls io.ReadAll(opts.IO.In) (login.go#L118-L124) unconditionally, with no check for whether stdin is a terminal and no prompt telling the user what to do. That explains the "hangs with no feedback" symptom from #9789, and also explains the plaintext-echo issue you describe here: since there's no special handling for an interactive TTY, the terminal's normal echo stays on while the process blocks waiting for EOF (Ctrl-D), which is also why Enter alone doesn't submit the input. I'm suggesting duplicate (of #9789, which already tracks the core hang/EOF behavior and is labeled for design) along with gh-auth for the relevant command area. Since this adds a distinct angle (masked/hidden input and an explicit terminal-only error path), a maintainer may still want to fold the specifics into #9789 or keep them linked — flagging both as suggestions for a human to confirm.
That issue has been open since October 2024, and the problem still exists. Token authentication is a basic CLI operation: users should not need to read the source code to discover how to submit a token, or have their credential displayed on screen.
I’d submit a PR to fix this myself, but the repository’s contribution guidelines seem to prohibit external PRs for this issue. That’s why I’m bringing it up again: the problem still exists and needs to be fixed.
This is the same underlying interactive input problem already tracked in #9789, so I am going to close this as a duplicate.
Your point about the token remaining visible in the terminal and its scrollback is useful additional context. The direction suggested by @williammartin in #9789, rejecting interactive terminal input with a clear explanation, would technically change the behavior for anyone currently pasting a token and submitting it with Ctrl+D. However, I think that is acceptable because this option is intended to read the token noninteractively from standard input.
Thanks again for highlighting that the current behavior is both confusing and capable of exposing the credential.
Activity
cli-triage commentedon Oct 5, 2026
Thanks for the detailed report. This looks like the same underlying root cause as #9789: when
--with-tokenis set,gh auth logincallsio.ReadAll(opts.IO.In)(login.go#L118-L124) unconditionally, with no check for whether stdin is a terminal and no prompt telling the user what to do. That explains the "hangs with no feedback" symptom from #9789, and also explains the plaintext-echo issue you describe here: since there's no special handling for an interactive TTY, the terminal's normal echo stays on while the process blocks waiting for EOF (Ctrl-D), which is also why Enter alone doesn't submit the input. I'm suggestingduplicate(of #9789, which already tracks the core hang/EOF behavior and is labeled for design) along withgh-authfor the relevant command area. Since this adds a distinct angle (masked/hidden input and an explicit terminal-only error path), a maintainer may still want to fold the specifics into #9789 or keep them linked — flagging both as suggestions for a human to confirm.vladkens commentedon Oct 5, 2026
That issue has been open since October 2024, and the problem still exists. Token authentication is a basic CLI operation: users should not need to read the source code to discover how to submit a token, or have their credential displayed on screen.
I’d submit a PR to fix this myself, but the repository’s contribution guidelines seem to prohibit external PRs for this issue. That’s why I’m bringing it up again: the problem still exists and needs to be fixed.
babakks commentedon Oct 5, 2026
Thanks for raising this again, @vladkens! 🙏
This is the same underlying interactive input problem already tracked in #9789, so I am going to close this as a duplicate.
Your point about the token remaining visible in the terminal and its scrollback is useful additional context. The direction suggested by @williammartin in #9789, rejecting interactive terminal input with a clear explanation, would technically change the behavior for anyone currently pasting a token and submitting it with Ctrl+D. However, I think that is acceptable because this option is intended to read the token noninteractively from standard input.
Thanks again for highlighting that the current behavior is both confusing and capable of exposing the credential.
gh auth login --with-tokenhangs #9789