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' }
}
})
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.