Skip to content

Authentication fails since it can't access localhost in the broweer #773

Description

@asafm

Describe the bug

I did brew install successfully.
Run gh pr create. It displayed:

Notice: authentication required
Press Enter to open github.com in your browser...

The browser is opened with:

http://127.0.0.1:52046/callback?browser_session_id=1234&code=1234&state=1234

(masked values)

but it can't access it:

Firefox can’t establish a connection to the server at 127.0.0.1:52046.

Version: 0.6.4

Activity

  1. mislav commented on Apr 10, 2020

    @mislav
    Contributor

    Thank you for reporting!

    1. What is your OS? (If you used brew install, I'm assuming it's likely macOS?)
    2. Did the terminal where you ran gh pr create show any error messages or warnings around the time that Firefox tried to connect to the localhost server?
    3. Are you using Docker or ssh anywhere where you run gh?

    You can retry the operation by enabling verbose mode DEBUG=oauth gh pr create which will print additional information during authentication. I don't know if this will help, but it's worth a try! See if there is anything that sticks out to you please

  2. jamo commented on Apr 14, 2020

    @jamo

    I'm on ubuntu and running into the same issue, all my development is done on a headless system and on my thin client where I have a browser I'm unable to install any software. And hence apparently unable to get started with the app. I guess I'll have to figure out if I can pipe in a manual access token and reverse the config format.

    It's a really miserably bad experience 😢

  3. jamo commented on Apr 14, 2020

    @jamo

    Apparently one can manually create a config file ~/.config/gh/config.yml
    and fill in a personal access token:

    $ cat ~/.config/gh/config.yml
    github.com:
      - user: ${github username}
        oauth_token: ${personal access token from https://github.com/settings/tokens}
    

    Hope others find this useful

  4. mislav commented on Apr 14, 2020

    @mislav
    Contributor

    @jamo I'm sorry for the bad experience, and thank you for sharing our workaround.

    We plan to make it easier to paste in your generated token without having to manually edit any configuration file. #297

  5. asafm commented on Apr 24, 2020

    @asafm
    Author
  6. andreaganduglia commented on May 29, 2020

    @andreaganduglia

    I have the same issue on my old Ubuntu (14.04) with gh 0.9.0.

    DEBUG=oauth gh issue list
    Notice: authentication required
    Press Enter to open github.com in your browser... * Request at 2020-05-29 09:16:40.953632132 +0200 CEST m=+0.016907878
    * Request to https://api.github.com/repos/cli/cli/releases/latest
    * Request took 322.240487ms
    
    open https://github.com/login/oauth/authorize?client_id=******&redirect_uri=http%3A%2F%2F127.0.0.1%3A48475%2Fcallback&scope=repo+read%3Aorg+gist&state=*************
    Fontconfig warning: "/etc/fonts/fonts.conf", line 86: unknown element "blank"
    [15804:15824:0529/091647.252711:ERROR:browser_process_sub_thread.cc(217)] Waited 3 ms for network service
    

    and yes I have some docker stuff.

    p.s. I think the work around should be in documentation if it's works, for headless machines at least.

    docker0   Link encap:Ethernet  HWaddr 56:84:7a:fe:97:99  
              inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
  7. vilmibm commented on Aug 13, 2020

    @vilmibm
    Contributor

    @mislav is this still something you think warrants investigation or is it ok to close?

  8. asafm commented on Aug 17, 2020

    @asafm
    Author

    I just checked it and the flow worked good, cli to browser and back. Version 0.9.0

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