How use List Pull Requests API with App Passwords (and Basic Auth)?

harri_rajala_koivu_solutions
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!
March 14, 2022

I'm trying to use List Pull Request API with App Password.

https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-get

I'm using Basic Auth. If I use my account password, then the API response is following.

Bitbucket Cloud recently stopped supporting account passwords for API authentication.
See our community post for more details: https://atlassian.community/t5/x/x/ba-p/1948231
App passwords are recommended for most use cases and can be created in your Personal settings:
https://bitbucket.org/account/settings/app-passwords/
For more details on API authentication methods see our documentation:
https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication

So I created App Password and selected all permissions. And then, I changed Basic Auth to use App Passwords. The username is "Name of the App Password," and the password is  "Password of the App Password." 

Now the response of the same List Pull Request API is

401 Unauthorized

Is there anything else that I have to do to make it work? Like I said that I gave all permissions to the app password. And according to Bitbucket API, I can use app passwords with Basic Auth.

https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication

Note that Basic Auth is available only with username and app password as credentials

 

1 answer

1 accepted

0 votes
Answer accepted
Neil
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2022

Hi @harri_rajala_koivu_solutions - to use app passwords in basic auth, the username you'd use is your Bitbucket username (visit https://bitbucket.org/account/settings/ to see/change your username). As I understood it, you were trying to use the label that you attributed to the app password when you created it. 

harri_rajala_koivu_solutions
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!
March 14, 2022

Thanks, that worked.

Praveen Kukreja September 20, 2023

Interesting. Day by day, i feel it is much efficient to go through the support channel instead of spending hours decoding the Atlassian Documentation.

I wonder why such a simple piece of knowledge is hidden from the users and buried deep in the support channels. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events