Skip to content

failed to authenticate via web browser #8623

Closed

Description

@bye-byte

Describe the bug

gh auth login
? What account do you want to log into? GitHub.com
? 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

failed to authenticate via web browser: Post "https://github.com/login/device/code": dial tcp 20.205.243.166:443: i/o timeout

Activity

  1. williammartin commented on Jan 25, 2024

    @williammartin
    Member

    Does this consistently fail? It looks like a connectivity issue between you and github.com?

  2. added
    more-info-neededMore info needed from user/contributor
    and removed on Jan 25, 2024
  3. bye-byte commented on Jan 25, 2024

    @bye-byte
    Author

    Yes, it keeps failing. I can access github using firefox. @williammartin

  4. williammartin commented on Jan 25, 2024

    @williammartin
    Member

    Interesting. There's not anything particularly surprising going on here, it's just sending an http request to github.com.

    A couple of interesting things, can you share the output of GH_DEBUG=api gh auth login making sure to retract any tokens for example the line: device_code=XYX&expires_in=899&interval=5&user_code=XYZ&verification_uri=https%3A%2F%2Fgithub.com%2Flogin%2Fdevice

    Can you tell me what happens if you curl this endpoint e.g:

    curl -X POST https://github.com/login/device/code
    

    Does it also timeout?

  5. bye-byte commented on Jan 26, 2024

    @bye-byte
    Author

    the output of GH_DEBUG=api gh auth login:

    GH_DEBUG=api gh auth login
    ? What account do you want to log into? GitHub.com
    ? What is your preferred protocol for Git operations on this host? HTTPS
    [git config credential.https://github.com.helper]
    [git config credential.helper]
    ? Authenticate Git with your GitHub credentials? Yes
    ? How would you like to authenticate GitHub CLI? Login with a web browser
    
    * Request at 2024-01-26 11:00:09.469224122 +0800 CST m=+43.911681202
    * Request to https://github.com/login/device/code
    > POST /login/device/code HTTP/1.1
    > Host: github.com
    > Content-Length: 66
    > Content-Type: application/x-www-form-urlencoded
    
    client_id=178c6fc778ccc68e1d6a&scope=repo+read%3Aorg+gist+workflow
    * dial tcp 20.205.243.166:443: i/o timeout
    * Request took 30.076320655s
    failed to authenticate via web browser: Post "https://github.com/login/device/code": dial tcp 20.205.243.166:443: i/o timeout
    

    the output of curl:

    curl -X POST https://github.com/login/device/code
    curl: (28) Failed to connect to github.com port 443 after 129420 ms: Couldn't connect to server
    

    @williammartin

  6. bye-byte commented on Jan 26, 2024

    @bye-byte
    Author

    BTW...When I open https://github.com/login/device/code using the browser, the page shows error code 404.

  7. williammartin commented on Jan 26, 2024

    @williammartin
    Member

    BTW...When I open https://github.com/login/device/code using the browser, the page shows error code 404.

    Yes I don't believe that endpoint serves GET requests so that wouldn't be surprising.

    What happens if you:

    curl -vvv https://github.com/login/device/code
    
  8. bye-byte commented on Jan 26, 2024

    @bye-byte
    Author

    curl -vvv https://github.com/login/device/code output:

    * Host github.com:443 was resolved.
    * IPv6: (none)
    * IPv4: 20.205.243.166
    *   Trying 20.205.243.166:443...
    * connect to 20.205.243.166 port 443 from 192.168.1.3 port 59074 failed: Connection timed out
    * Failed to connect to github.com port 443 after 129054 ms: Couldn't connect to server
    * Closing connection
    curl: (28) Failed to connect to github.com port 443 after 129054 ms: Couldn't connect to server
    
  9. williammartin commented on Jan 26, 2024

    @williammartin
    Member

    It seems that you have some connectivity issue between your terminal and github. Perhaps you have some kind of firewall preventing connections from the terminal (though I'd be surprised that DNS seems to work). Maybe your browser is set up to work through an HTTP_PROXY and your terminal isn't?

    Do you have any kind of connectivity from your terminal e.g.

    curl -vvv https://google.com
    

    or

    ping google.com
    
  10. bye-byte commented on Jan 26, 2024

    @bye-byte
    Author

    Ohhh,i see.I need set http_proxy in terminal.

    I can't access github smoothly without a proxy, so my network proxy is on.I need to set the proxy separately in the terminal.

    I have successfully authenticated. Thank you very much!

  11. williammartin commented on Jan 26, 2024

    @williammartin
    Member

    No problem glad I could help.

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

    bugSomething isn't workingmore-info-neededMore info needed from user/contributor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions