I want to build a command-line script (in bash or python) that reads files from my company's repo (a private repo in Bitbucket Cloud). My script does the equivalent of this:
curl -O https://bitbucket.org/mycompany/myproject/raw/abc123abc456/test.txt
I would like my script to be usable by coworkers (i.e. holders of valid Bitbucket Cloud accounts at mycompany).
I've created an Oauth consumer as described here, but this requires a callback URL, which is not possible for a command-line script.
I have also tried generating an API token as described here, and passing this as an HTTPDigestAuth password, but that fails (with 401 unauthorized) as well.
How can I generate a token and read from bitbucket cloud without a callback URL?
How should I write a command-line script that generates valid tokens and use them when fetching files from bitbucket cloud?
The URL callback is for receive the refresh token via URL parameter, you can put whatever URL.
You will need to refresh the access token each hour so in your script first you should use your OAuth credentials to achieve it via curl.
This curl will return a JSON where is the access token as access_token and then you could use it to read your repository.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.