defunkt / gist

Potentially the best command line gister.
http://defunkt.io/gist/
MIT License
3.8k stars 340 forks source link

Login fails #252

Open ghost opened 8 years ago

ghost commented 8 years ago

Instead of a successful login I get this message:

/usr/bin/gist:1694:in `rescue in http': Could not connect to https://api.github.com/ (RuntimeError)
    from /usr/bin/gist:1688:in `http'
    from /usr/bin/gist:1643:in `block in login!'
    from /usr/bin/gist:1614:in `loop'
    from /usr/bin/gist:1614:in `login!'
    from /usr/bin/gist:1896:in `block (2 levels) in <main>'
    from /usr/lib/ruby/2.3.0/optparse.rb:1540:in `block in parse_in_order'
    from /usr/lib/ruby/2.3.0/optparse.rb:1527:in `catch'
    from /usr/lib/ruby/2.3.0/optparse.rb:1527:in `parse_in_order'
    from /usr/lib/ruby/2.3.0/optparse.rb:1521:in `order!'
    from /usr/lib/ruby/2.3.0/optparse.rb:1613:in `permute!'
    from /usr/lib/ruby/2.3.0/optparse.rb:1635:in `parse!'
    from /usr/bin/gist:1975:in `<main>'
akerl commented 8 years ago

What version of gist/ruby are you using? Can you connect to https://api.github.com/ using curl or other tools?

I'm not able to replicate this on my system:

❯ gist --login
Obtaining OAuth2 access_token from github.
GitHub username: akerl
GitHub password:
2-factor auth code: 074938

Success! https://github.com/settings/applications
~ bean  20s
❯ gist --version
gist v4.5.0
~ bean
❯ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
ghost commented 8 years ago
$ curl https://api.github.com
{
  "current_user_url": "https://api.github.com/user",
  "current_user_authorizations_html_url": "https://github.com/settings/connections/applications{/client_id}",
  "authorizations_url": "https://api.github.com/authorizations",
  "code_search_url": "https://api.github.com/search/code?q={query}{&page,per_page,sort,order}",
  "emails_url": "https://api.github.com/user/emails",
  "emojis_url": "https://api.github.com/emojis",
  "events_url": "https://api.github.com/events",
  "feeds_url": "https://api.github.com/feeds",
  "followers_url": "https://api.github.com/user/followers",
  "following_url": "https://api.github.com/user/following{/target}",
  "gists_url": "https://api.github.com/gists{/gist_id}",
  "hub_url": "https://api.github.com/hub",
  "issue_search_url": "https://api.github.com/search/issues?q={query}{&page,per_page,sort,order}",
  "issues_url": "https://api.github.com/issues",
  "keys_url": "https://api.github.com/user/keys",
  "notifications_url": "https://api.github.com/notifications",
  "organization_repositories_url": "https://api.github.com/orgs/{org}/repos{?type,page,per_page,sort}",
  "organization_url": "https://api.github.com/orgs/{org}",
  "public_gists_url": "https://api.github.com/gists/public",
  "rate_limit_url": "https://api.github.com/rate_limit",
  "repository_url": "https://api.github.com/repos/{owner}/{repo}",
  "repository_search_url": "https://api.github.com/search/repositories?q={query}{&page,per_page,sort,order}",
  "current_user_repositories_url": "https://api.github.com/user/repos{?type,page,per_page,sort}",
  "starred_url": "https://api.github.com/user/starred{/owner}{/repo}",
  "starred_gists_url": "https://api.github.com/gists/starred",
  "team_url": "https://api.github.com/teams",
  "user_url": "https://api.github.com/users/{user}",
  "user_organizations_url": "https://api.github.com/user/orgs",
  "user_repositories_url": "https://api.github.com/users/{user}/repos{?type,page,per_page,sort}",
  "user_search_url": "https://api.github.com/search/users?q={query}{&page,per_page,sort,order}"
}

$ gist --version
gist v4.5.0
$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
geoffjay commented 8 years ago

I don't know whether or not this is related, but I'm unable to login as well using the CLI. Running curl on api.github.com works and versions of things are:

$ gist --version
gist v4.5.0
$ ruby --version
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]

Mine fails to complete at the 2-factor auth code input with the error Error: Must specify authentication OTP code. but I can guarantee that what's being entered is correct after multiple failed attempts and successful logins using other means with the same app use to generate the 2FA code.