我确信这是一个简单的错误,但我有兴趣编写一个程序来收集我所有 github 存储库的信息。虽然这对 Octokit 来说似乎很简单,但我遇到了与验证会话相关的问题。
client = Octokit::Client.new \
:login => 'MY_USER_NAME',
:password => 'MY_PASSWORD'
puts client
user = client.user("MY_USER_NAME", :headers => { "PERSONAL_ACCESS_TOKEN_NAME" => "TOKEN" })
puts user
不幸的是,这会导致以下结果:
GET https://api.github.com/users/mccoleman75225: 401 - Must specify two-factor authentication OTP code. // See: https://developer.github.com/v3/auth#working-with-two-factor-authentication (Octokit::OneTimePasswordRequired)
有人如何验证他们的会话?