Giter Site home page Giter Site logo

Token with bitbucket? about cookbook-deploy_key HOT 13 OPEN

c10l avatar c10l commented on July 30, 2024
Token with bitbucket?

from cookbook-deploy_key.

Comments (13)

c10l avatar c10l commented on July 30, 2024

I'm not sure what's the API key you're using for password. My understanding is that if you use HTTP Basic authentication (as when you supply the LWRP with a user/pass combination) you're using an actual Bitbucket user and its password for credentials.

The token authentication scheme is for OAuth tokens.

from cookbook-deploy_key.

allaire avatar allaire commented on July 30, 2024

See here: https://confluence.atlassian.com/display/BITBUCKET/Use+the+Bitbucket+REST+APIs#UsetheBitbucketRESTAPIs-Authentication

You can use the Bitbucket API key for authentification (password).

The page oauth page you linked to creates two keys

from cookbook-deploy_key.

c10l avatar c10l commented on July 30, 2024

Hey, sorry for not having looked into this for so long, but I was busy moving to another country. :)

I couldn't find any mention to an API key on the docs you linked. That's for a user's username and password as I mentioned before (or I might be drunk).

For the OAuth scheme, you have to create an Application Key first, then create an Access Token. The latter is the one you'll use to authenticate against the API.

from cookbook-deploy_key.

bgaillard avatar bgaillard commented on July 30, 2024

Hi, I follow the guide provided here to create an Access Token.

https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket

At the end of the guide (Step 4. Request an Access Token) the last request returns something like this :

oauth_token_secret=XXXX&oauth_token=YYYY

What do I have to use in the :token parameter ? Is it XXXX or YYYY ?

I tried both but I always get an HTTP 403 error (Access Forbidden).

deploy_key "bitbucket_key" do
  provider Chef::Provider::DeployKeyBitbucket
  path '/home/vagrant/.ssh'
  credentials({
    :token => 'XXXX'
  })
  repo 'my_company/my_project'
  owner 'vagrant'
  group 'vagrant'
  mode 00640
  action :add
end

Thanks,

Baptiste

from cookbook-deploy_key.

c10l avatar c10l commented on July 30, 2024

I have to be honest with you and say that I haven't used this auth mechanism in BitBucket.

That said, have you tried sending the whole string, as in :token => 'oauth_token_secret=XXXX&oauth_token=YYYY'? That seems to be what you need. Let me know if it works for you.

from cookbook-deploy_key.

bgaillard avatar bgaillard commented on July 30, 2024

Hi @cassianoleal, thanks for you quick response.

I tried with :token => 'oauth_token_secret=XXXX&oauth_token=YYYY' but encounter the same 403 error code.

from cookbook-deploy_key.

mariomarin avatar mariomarin commented on July 30, 2024

@bgaillard Did you find a workaround?

from cookbook-deploy_key.

bgaillard avatar bgaillard commented on July 30, 2024

Hi @mariomarin, sadly I did not found any solution for this, let me know if you find a workaround.

from cookbook-deploy_key.

c10l avatar c10l commented on July 30, 2024

I've been doing some reading, and this should actually have been a full-blown OAuth implementation. I'll have to study it a bit further in order to get this to work, and I'm not sure I'll have the time any time soon.

If any of you want to take a stab at it, please do so. Pull requests are always welcome! 😄

from cookbook-deploy_key.

paralin avatar paralin commented on July 30, 2024

Wow, the last message on this is really recent.

I'd also like to set this up properly. It seems you have to get the token like

https://bitbucket.org/api/1.0/oauth/request_token?oauth_version=1.0&oauth_nonce=7f2325b3c36bd49afa0a33044d7c6930&oauth_timestamp=1366243208&oauth_consumer_key=HUpRcDUduZrepL6sYJ&oauth_callback=http%3A%2F%2Flocal%3Fdump&oauth_signature_method=HMAC-SHA1&oauth_signature=qZyTwVA48RzmtCHvN9mYWmlmSVU%3D

So we would need a full oauth implementation...

Why not just use https://github.com/vongrippen/bitbucket? Install the bitbucket gem and use the API to deploy.

from cookbook-deploy_key.

7h3kk1d avatar 7h3kk1d commented on July 30, 2024

+1

from cookbook-deploy_key.

c10l avatar c10l commented on July 30, 2024

@kidovate I might have a look at that. It's worth noting, though that the maintainer has dropped support for that gem.

from cookbook-deploy_key.

dynnamitt avatar dynnamitt commented on July 30, 2024

https://bitbucket.org/site/master/issue/10182/access-tokens-for-command-line-use

from cookbook-deploy_key.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.