Giter Club home page Giter Club logo

Comments (14)

lfcipriani avatar lfcipriani commented on May 27, 2024 1

Les Peabody, I found a well documented way to obtain the access token. I've tested locally and it worked.

http://wiki.openstreetmap.org/wiki/OAuth_ruby_examples

Section "Registering and Authorizing your application"

from bitbucket.

lfcipriani avatar lfcipriani commented on May 27, 2024

+1 for solving this

from bitbucket.

vongrippen avatar vongrippen commented on May 27, 2024

Ok, I've been scratching my head on this one for a while trying to make it fail myself and I think I realized what is going on here (and it's totally my fault!)

I think it's bad documentation on my part (which I will update right now):
oauth_token and oauth_secret should actually be your request tokens, not your consumer tokens. See: https://confluence.atlassian.com/display/BITBUCKET/oauth+Endpoint

from bitbucket.

vongrippen avatar vongrippen commented on May 27, 2024

The full API docs were more clear than the readme, so I've updated the readme to make it clear the difference between the two in the config block.

from bitbucket.

lfcipriani avatar lfcipriani commented on May 27, 2024

Sorry for the ignorance,

But BitBucket website only shows consumer key and secret, what about the other values?
Should I put consumer key and secret in client_id and client_secret? Or oauht_token, oauth_secret?

Thanks

from bitbucket.

vongrippen avatar vongrippen commented on May 27, 2024

The other values are generated per-user by BitBucket during an OAuth authorization. I personally use Devise to do that since I'm allowing OAuth login with devise.

The consumer key and secret do belong in client_id and client_secret

from bitbucket.

lfcipriani avatar lfcipriani commented on May 27, 2024

Okay, I thought that the gem would do all the auth flow for me. So, there is no way to do all the flow without user intervention?

Thanks for taking time to answer.

from bitbucket.

vongrippen avatar vongrippen commented on May 27, 2024

No, OAuth requires user interaction to authorize the token generation. Though, that token generation only has to occur once so long as you store the request tokens.

from bitbucket.

lpeabody avatar lpeabody commented on May 27, 2024

Hey Mike, you've been super helpful today.

So the way I'm reading this, I feel as if I should only have to specify the oauth key and secret generated by Bitbucket in the client_id and client_secret fields respectively. I'm a bit confused as to what needs to happen after that, because shouldn't obtaining the oauth request token and secret at that point be completely automated?

from bitbucket.

vongrippen avatar vongrippen commented on May 27, 2024

Obtaining the request token and secret really can't be automated because it requires the end user to approve the authorization request from the app (via the BitBucket website). An authorization URL can be generated that the user is directed to on the BitBucket website, where the user is asked for approval, once they approve the access then BitBucket redirects the user back to a URL you specify as the callback with the request token and secret attached (which you would then store somewhere, such as a database).

from bitbucket.

lfcipriani avatar lfcipriani commented on May 27, 2024

Thanks Mike.

Les Peabody, to use the gem, you will need to use any library or Oauth playground (http://googlecodesamples.com/oauth_playground/) where you could obtain the access token. This means that part of the OAuth flow will be done manually, but just one time, because the access token doesn't expire.

from bitbucket.

lpeabody avatar lpeabody commented on May 27, 2024

So prior to doing anything with this gem I need to get that request and access token first? Okay cool, this is a good start.

All of this info has been extremely helpful. I'm planning a massive, automated migration of our Subversion repositories over to Git on Bitbucket and was hoping to use this awesome gem to do so. I'll play around later, but assuming I can somehow automate everything in a script my goal should be doable :) Thanks guys.

from bitbucket.

vongrippen avatar vongrippen commented on May 27, 2024

If it's a local script and not a web service that you are building then you might find it easier to use HTTP Basic Auth instead, where you can just specify to connect as "user:password", rather than the more complicated OAuth method. Just be careful about the security of the script. Of course, this supposes that all of the repositories would be owned by the same user on BitBucket.

from bitbucket.

lpeabody avatar lpeabody commented on May 27, 2024

Money. Thanks dude!

from bitbucket.

Related Issues (20)

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.