Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't workinggh-authrelating to the gh auth commandrelating to the gh auth commandplatformProblems with the GitHub platform rather than the CLI clientProblems with the GitHub platform rather than the CLI client
Description
Describe the bug
Intermittently, logging in to GitHub using the Device Code Flow results in an error:
failed to authenticate via web browser: The device_code provided is not valid. (incorrect_device_code)
This occurs even though the browser portion of the flow succeeds. I believe this is related to the speed at which I proceed through the login process and perhaps indicates a platform race condition but I'm unable to confirm that. I've never noticed this before and there's no report of it in this repo, so I wonder if something changed recently, perhaps exposing this issue?
➜ gh version
gh version 2.50.0 (2024-05-29)
https://github.com/cli/cli/releases/tag/v2.50.0
Logs
➜ gh auth login
? What is your preferred protocol for Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: ...
Press Enter to open github.com in your browser...
failed to authenticate via web browser: The device_code provided is not valid. (incorrect_device_code)
I have logs with GH_DEBUG=api turned on but I'm not going to copy them verbatim because I can't remember the exact sensitivity of certain request bodies. The failing request is:
* Request to https://github.com/login/oauth/access_token
> POST /login/oauth/access_token HTTP/1.1
...
error=incorrect_device_code&error_description=The+device_code+provided+is+not+valid.&error_uri=https%3A%2F%2Fdocs.github.com%2Fdevelopers%2Fapps%2Fauthorizing-oauth-apps%23error-codes-for-the-device-flow
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggh-authrelating to the gh auth commandrelating to the gh auth commandplatformProblems with the GitHub platform rather than the CLI clientProblems with the GitHub platform rather than the CLI client
Activity
williammartin commentedon Jul 25, 2024
I believe this was a race condition in the platform which is now fixed.
fix(publisher): tolerate transient device-flow failures during login …