The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Corey Malcom
March 17, 2021

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events