wget on repository file returning 401

andykimpe December 14, 2022

this not work

 

wget --user=BitbucketUsername --password=AppPassword --auth-no-challenge https://bitbucket.org/workspace-id/repo-slug/raw/master/folderA/folderB/folderC/file.xml

 

please solve error

 

--2022-12-14 13:54:57-- https://bitbucket.org/workspace-id/repo-slug/raw/master/folderA/folderB/folderC/file.xml
Resolving bitbucket.org (bitbucket.org)... 104.192.141.1, 2406:da00:ff00::22c5:2ef4, 2406:da00:ff00::22c0:3470, ...
Connecting to bitbucket.org (bitbucket.org)|104.192.141.1|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.

3 answers

0 votes
andykimpe December 16, 2022

already my project need to use wget and not curl and your BitbucketUsername:AppPassword is not working I already try them and neither on the api nor on the raw file

 

wget --user=BitbucketUsername --password=AppPassword --auth-no-challenge https://bitbucket.org/workspace-id/repo-slug/raw/master/folderA/folderB/folderC/file.xml

 

not work return 404

 

wget https://BitbucketUsername:AppPassword@bitbucket.org/workspace-id/repo-slug/raw/master/folderA/folderB/folderC/file.xml

 

not work return 404

 

wget --user=BitbucketUsername --password=AppPassword --auth-no-challenge https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/src/maste/folderA/folderB/folderC/file.xml

 

not work

 

return this error

 

{"type":"error","error":{"message":"You may not have access to this repository or it no longer exists in this workspace. If you think this repository exists and you have access, make sure you are authenticated."}}

 

 

wget https://BitbucketUsername:AppPassword@api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/src/maste/folderA/folderB/folderC/file.xml

 

not work

 

return this error

 

{"type":"error","error":{"message":"You may not have access to this repository or it no longer exists in this workspace. If you think this repository exists and you have access, make sure you are authenticated."}}

 

 

the only one that works is with the token

and still only one works

 

wget --user=x-token-auth --password=privatetoken --auth-no-challenge https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/src/maste/folderA/folderB/folderC/file.xml

 

not work

 

return this error

 

{"type":"error","error":{"message":"You may not have access to this repository or it no longer exists in this workspace. If you think this repository exists and you have access, make sure you are authenticated."}}

 

wget https://x-token-auth:privatetoken@api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/src/maste/folderA/folderB/folderC/file.xml

 

not work

 

return this error

 

{"type":"error","error":{"message":"You may not have access to this repository or it no longer exists in this workspace. If you think this repository exists and you have access, make sure you are authenticated."}}

 

 

wget --header "Authorization: Bearer privatetoken" https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/src/maste/folderA/folderB/folderC/file.xml

 

 

only this work

 

which can be disturbing because some config

cannot pass custom header

nor make a post request

it would therefore be necessary to ensure that one of those is 100% functional without which there is no other verification therefore no verification of user-agent or others

 

 

https://BitbucketUsername:AppPassword@bitbucket.org/workspace-id/repo-slug/raw/master/folderA/folderB/folderC/file.xml

 

or

 

https://BitbucketUsername:AppPassword@api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/src/maste/folderA/folderB/folderC/file.xml

 

or

 

https://x-token-auth:privatetoken@bitbucket.org/workspace-id/repo-slug/raw/master/folderA/folderB/folderC/file.xml

 

or

 

https://x-token-auth:privatetoken@api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/src/maste/folderA/folderB/folderC/file.xml

 

except none of those works

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 16, 2022

Hi @andykimpe and welcome to the community.

It is not possible to download repository source code files this way. You can use our API instead:

Below is an example call with curl:

curl -u BitbucketUsername:AppPassword https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/src/master/myFile.xml -o myFile.xml

Please feel free to let me know if this works for you.

Just a heads up I removed the file URL from your post to comply with our privacy policy. I also moved your post to a separate question; it's best to create a new question if you need assistance, as a post can become difficult to follow if we troubleshoot multiple users' different issues.

Kind regards,
Theodora

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 14, 2022

Welcome to the Atlassian Community!

Bitbucket username/password authentication was deprecated over 6 months ago.  See https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events