Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,644,336
Community Members
 
Community Events
196
Community Groups

Bitbucket downloads | In-URL-Authentication for file download

To automate deployment, I need to provide a URL to a file on BitBucket Download.

As the receiving service has no functionality to add a header, the authentication must be included in the URL.

 

For the upload, I can include credentials in this schema (found here, Step 3b):

https://${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads

However, this seems not possible for the download of a file. I tried this schema:

https://${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/build.zip

 

In this very old post, it sounds like there is a way to get a generated URL, with a 24h-token.

This would be the perfect fit for this use case.

 

Thank you for any hint!

1 answer

1 vote
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 13, 2022

Hey Robin,

Files cannot be downloaded by navigating directly to a URL for the Downloads section of a Bitbucket Repo.

This is because the default method for authentication over HTTPS is username/password which has been deprecated.

You will need to make use of a cURL command to handle this, for example:

curl -L -u username:AppPassword https://api.bitbucket.org/2.0/repositories/{workspace_ID}/{repository_slug}/downloads/filename.ext --output filename.ext

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

Hey Ben

Thank you for your response.

The only option i have is to send one URL where the service downloads the build. So this doesn't help in this case.

I don't understand why it is not implemented to authenticate this way for the download as it is already possible for the upload.

Thank you & best regards

Robin

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 18, 2022

Hi Robin,

The above that I have specified is to download particular files from the Downloads directory, so apologies for the confusion.

I have tested the below URL format to download builds (ie certain commit hashes) and this has worked from my end - if it does not I would suggest double checking the App Password and updating it if this is not correct:

https://{BITBUCKET_USERNAME}:{BITBUCKET_APP_PASSWORD}@bitbucket.org/{WORKSPACEID}/{REPOSLUG}/get/{COMMITHASH}.zip

 

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

Really helpful.

Thank you Ben!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events