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

Issue with 401 Error for api.bitbucket.org/2.0/repositories/{workspace}/{repository}/commits

엄성렬SA September 9, 2024

Hi, 

When configuring a Bamboo plan environment, the repository to be used was added under the Default plan configuration > Repositories menu.
Currently, the method to connect Bamboo to Bitbucket Cloud involves adding an app password from the Bitbucket Cloud account, and then adding this key under the Bamboo Shared Credentials menu, which allowed successful registration.
However, as of September 6th, repository registration is failing for all IDs except for a specific ID's Shared Credentials. My account has admin privileges on both Bitbucket and Bamboo, but I am still unable to register repositories (this was previously working without any issues).
The currently applied plans are still functional, but there is a problem when trying to register additional repositories.

Upon checking, the account that works can query the URL without any issues, but the app password of the problematic account returns a 401 error with the following request: https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/commits

I would like to know the reason for the 401 error and the solution, even though both accounts have the same permissions.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2024

Hi @엄성렬SA,

A 401 error means that the credentials provided are not valid.

Are you also using a username along with the app password? An app password cannot be used by itself for authentication. You need to provide the Bitbucket username of the account that you generated the app password for. The username can be found on the following page, after you log in to the account:

 

I suggest the following steps to confirm if the credentials are correct and work:

1. Log in to https://bitbucket.org with the account you generated the app password for

2. Double check the username listed here: https://bitbucket.org/account/settings/

3. Then, run the following curl command from a terminal application on your computer:

curl -u username:app_password --request GET \
--url https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/commits \
--header 'Accept: application/json'

where

username replace with the Bitbucket username from step 2
app_password replace with the app password you generated for this account
workspace-id replace with the id of the workspace where this repo belongs
repo-slug replace with the slug for the repo

Do you get the repo's commits when you execute this curl call?

Kind regards,
Theodora

엄성렬SA September 10, 2024

Hi, @Theodora Boudale 

I try to curl, but it occur 401 error

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 11, 2024

Hi @엄성렬SA,

Thank you for your reply.

Since the curl command also fails, then the credentials are not correct.

If you have ensured that the username is correct, please generate a new app password from

and then try the curl command with the new app password. Does it succeed then?

If you only need to perform a GET to the commits endpoint, then Repositories - Read permissions for the app password are enough. For Bamboo, if Bamboo makes additional operations other than cloning or getting commits, then additional permissions may be needed for the app password.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events