4

With a private repo on github, I can generate a "personal access token" and

curl https://<oauth-secret>:[email protected]/<me>/<repo>/master/<file> 

and get the content of the file. Is the same thing possible with bitbucket?

3 Answers 3

2

Oh hey, it turns out you can just use http(s) authentication.

curl --user <username>:<password> https://bitbucket.org/<username>/<repo>/raw/<file> 

It's a bit of a bigger security hole having a username and password in a script than a token (for which you can restrict permissions), but it gets the job done in this case.

Sign up to request clarification or add additional context in comments.

Comments

1

According to OAuth on Bitbucket Cloud you need to write https://x-token-auth:{access_token}@bitbucket.org so that you are using the token as password instead of username.

Comments

1

Use OAuth token and Bitbucket api with access_token param:

https://api.bitbucket.org/2.0/repositories/{username}/{repo_slug}/src/master/{file}?access_token={access_token}

1 Comment

I'm trying this, however I'm presented with the following error: {"type": "error", "error": {"message": "Token is invalid or not supported for this endpoint."}}

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.