Closed casecamp closed 7 years ago
@casecamp Let's rule out a couple of things first:
access_token
variable is populated? If so, test that token via curl with:
curl -H"Authorization: token
works fine on this side
I think I'm seeing the same problem, using Octokit 4.7.0 under Ruby 2.3. My script is:
!/usr/bin/env ruby
require 'dotenv/load'
require 'octokit'
Octokit.configure{|c|
c.access_token = ENV['GITHUB_TOKEN']
}
repo = 'retorquere/zotero-better-bibtex'
release = Octokit.release_for_tag(repo, 'update.rdf')
The token is a freshly generated personal access token with repo:status
, repo_deployment
and public_repo
access.
The full error is:
/home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/octokit-4.7.0/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://api.github.com/repos/retorquere/zotero-better-bibtex/releases/tags/update.rdf: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/faraday-0.9.2/lib/faraday/response.rb:9:in `block in call'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/faraday-0.9.2/lib/faraday/response.rb:57:in `on_complete'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/faraday-0.9.2/lib/faraday/response.rb:8:in `call'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/octokit-4.7.0/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/octokit-4.7.0/lib/octokit/middleware/follow_redirects.rb:61:in `call'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/faraday-0.9.2/lib/faraday/connection.rb:140:in `get'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/sawyer-0.8.1/lib/sawyer/agent.rb:94:in `call'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/octokit-4.7.0/lib/octokit/connection.rb:156:in `request'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/octokit-4.7.0/lib/octokit/connection.rb:19:in `get'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/octokit-4.7.0/lib/octokit/client/releases.rb:137:in `release_for_tag'
from /home/emile/.rvm/gems/ruby-2.3.0@zotero/gems/octokit-4.7.0/lib/octokit.rb:46:in `method_missing'
I created a new token with all the repo scopes, and called your script, which succeeded.
Do you get the expected token when you call puts ENV['GITHUB_TOKEN']
?
I'm going to close this. If you are able to create reproduction steps, please open a new issue.
client = Octokit::Client.new(:access_token => access_token)
If i use this method thenuser = client.user
gives bad credentials errror, only basic authentication working, other authentications gives same error.
Using octokit 4.6.2