Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consumer key not working #62

Open
shubhamitc opened this issue Apr 4, 2016 · 1 comment
Open

Consumer key not working #62

shubhamitc opened this issue Apr 4, 2016 · 1 comment

Comments

@shubhamitc
Copy link

bitbucket.repos.all

BitBucket::Error::Unauthorized: #<struct Faraday::Env method=:get, body="", url=#<URI::HTTPS https://bitbucket.org/api/1.0/user/repositories>, request=#<Faraday::RequestOptions proxy=#<Faraday::ProxyOptions uri=#<URI::HTTP http://10.6.13.77:8080/>>, oauth=true>, request_headers={"User-Agent"=>"BitBucket Ruby Gem 0.1.7", "Authorization"=>"OAuth oauth_consumer_key="XXX", oauth_nonce="d161352d7fd1b7ba7207a457c43038cf", oauth_signature="%2BsDwJGrBRMcSYkoxmDc%2BVJFtAZg%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1459756974", oauth_token="", oauth_version="1.0""}, ssl=#<Faraday::SSLOptions (empty)>, parallel_manager=nil, params=nil, response=#<Faraday::Response:0x000000021c3318 @on_complete_callbacks=[], @env=#<Faraday::Env @method=:get @Body="" @url=#<URI::HTTPS https://bitbucket.org/api/1.0/user/repositories> @request=#<Faraday::RequestOptions proxy=#<Faraday::ProxyOptions uri=#<URI::HTTP http://10.6.13.77:8080/>>, oauth=true> @request_headers={"User-Agent"=>"BitBucket Ruby Gem 0.1.7", "Authorization"=>"OAuth oauth_consumer_key="XXX", oauth_nonce="d161352d7fd1b7ba7207a457c43038cf", oauth_signature="%2BsDwJGrBRMcSYkoxmDc%2BVJFtAZg%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1459756974", oauth_token="", oauth_version="1.0""} @ssl=#<Faraday::SSLOptions (empty)> @response=#<Faraday::Response:0x000000021c3318 ...> @response_headers={"server"=>"nginx/1.6.2", "vary"=>"Cookie", "www-authenticate"=>"Basic realm="Bitbucket.org HTTP"", "content-type"=>"text/html; charset=utf-8", "strict-transport-security"=>"max-age=31536000", "date"=>"Mon, 04 Apr 2016 08:02:54 GMT", "x-served-by"=>"app-113", "x-static-version"=>"9d27a7681f21", "etag"=>""d41d8cd98f00b204e9800998ecf8427e"", "x-render-time"=>"0.00727915763855", "connection"=>"close", "x-version"=>"9d27a7681f21", "x-request-count"=>"212", "x-frame-options"=>"SAMEORIGIN", "content-length"=>"0"} @status=401>>, response_headers={"server"=>"nginx/1.6.2", "vary"=>"Cookie", "www-authenticate"=>"Basic realm="Bitbucket.org HTTP"", "content-type"=>"text/html; charset=utf-8", "strict-transport-security"=>"max-age=31536000", "date"=>"Mon, 04 Apr 2016 08:02:54 GMT", "x-served-by"=>"app-113", "x-static-version"=>"9d27a7681f21", "etag"=>""d41d8cd98f00b204e9800998ecf8427e"", "x-render-time"=>"0.00727915763855", "connection"=>"close", "x-version"=>"9d27a7681f21", "x-request-count"=>"212", "x-frame-options"=>"SAMEORIGIN", "content-length"=>"0"}, status=401>
`

Need help to understand how to achieve this.

@kdiogenes
Copy link

Take a look at #4

If you are using OAuth2 you can take a look at https://github.com/intridea/oauth2#authorization-grants. I used the client_credentials to generate an access_token, then I configure this gem with the following:

BitBucket.new client_id: 'xxx', client_secret: 'yyy', new_access_token: 'access_token_returned_by_client_credentials'

ibrahima added a commit to ibrahima/bitbucket that referenced this issue Nov 16, 2016
Couldn't figure out how to authenticate with OAuth2 until I found this comment in the issues: bitbucket-rest-api#62 (comment) . This example should help with that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants