Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
Cannot connect to Github account using octokit

I fail to connect to GitHub and get my account credential using the "octokit" gem.

client = Octokit::Client.new(
    client_id: ENV['GITHUB_CLIENT_ID'],
    client_secret: ENV['GITHUB_CLIENT_SECRET'],
 )

Gem File:

ruby '2.7.2'
gem 'rails', '~> 6.1.4', '>= 6.1.4.3'
gem "octokit", "~> 4.0"

Error message: Octokit::Unauthorized (GET https://api.github.com/user: 401 - Requires authentication // See: https://docs.github.com/rest/reference/users#get-the-authenticated-user)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I had the same problem. I solved problem just like this:

client.user(ENV['GITHUB_LOGIN'], :headers => { "X-GitHub-OTP" => "2fa-token"})

If you don't have an ENV['GITHUB_LOGIN'], just type Github username

client.user('codescaptain', :headers => { "X-GitHub-OTP" => "2fa-token"})
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!