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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unauthorized downloading an individual file, but no problem downloading whole repository

I am successfully downloading the entire archived repository using the following url with 'Basic Auth' and an app password.

url:   https://bitbucket.org/<workspace>/<repoSlug>/get/<branchName>.zip

HOWEVER, if I do something similar to access an individual file with the identical 'Basic Auth' using app password, I get a 401 Unauthorized:

url:  https://bitbucket.org/<workspace>/<repoSlug>/raw/<branchName>/filename.json

 

If I put the second url into my browser it downloads the file just fine.

Can someone help with this inconsistency?  I need to be able to download the file at the root of the repository without having to extract the archive and get it that way.

Help appreciated!

 

These are the requests being made.  As mentioned the top request works fine to retrieve the archive, but the auth headers seem to be inconsistent with the individual file request:

const auth = new Buffer.from(`username:password`).toString('base64');
axios.request({
method: 'get',
url: url,
responseType: 'stream',
headers: {
Authorization: auth
}
});

OR

axios.request({
method: 'get',
url: url,
responseType: 'stream',
headers: {
auth: { username: 'username', password: 'password' }
}
})

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,741 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you