I keep getting a 401 error when running my script how do I fix this

Cheikh Oumar Toure
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 4, 2025

I am writing a python script that goes into a repo in bitbucket and takes the baseline data and puts it into an excel file into an organized fashion. In the script I have it so that it uses my username and password to access bit bucket but when I enter it into the terminal, I end up a 401 error and it is saying my authentication is incorrect so I just don't know what else I can do to fix it because I have full access to the repo, I created it. I have it set for my bitbucket password and my app password.

1 answer

0 votes
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 5, 2025

G'day, @Cheikh Oumar Toure 

Welcome to the community!

401 error means you are not authorized, which could mean your authentication is invalid. Please confirm that you've used your Username and generated an App password with relevant permission.

Also, please share the endpoint you are using so I can suggest the permission require.

Regards,
Syahrul

Cheikh Oumar Toure
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 6, 2025

I am doing it on vs code

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 7, 2025

Hi @Cheikh Oumar Toure,

Regardless of where you run the script, the authentication details need to be correct for the script to work.

An email address and an account's password can only be used for logging in to https://bitbucket.org/ from browser. They will not work with API calls or Git operations via HTTPS.

If you are running API calls or cloning a repo via HTTPS and you want to use your user's credentials, then you'll need to use:

If you share with us the API endpoint(s) you are using in your script, we can let you know what permissions are required for the app password.

If you are doing a 'git clone' of the repo via HTTPS, then Repositories - Read permissions are enough for the app password.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events