Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding group to a repository via access token

Sachin
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!
October 25, 2023

Hi, 

As per Documentation i am trying to add group to repository via access token and i am getting following error 

curl --request PUT \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "permission": "read" }'

 

message": "This API is only accessible with the following authentication types: apppassword, session"}}

Documentation 
The Bitbucket Cloud REST API (atlassian.com)

 

I tried to do the same with app password and its working, however i want to achieve this with access token for automation, providing app password for organization level is not good idea, if in future my account is deactivated this Api will fail with app password authentication. 

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 26, 2023

Hello @Sachin !

Welcome to the Community!

Access tokens are indeed currently not supported in the Repository permissions endpoints, but we already have a feature request with our development team to add that authentication option to those endpoints : 

We encourage you to Vote in that feature so our product managers can better understand the interest. If you would like to be notified whenever an update is posted on that feature, feel free to follow it by clicking on Start watching this issue option.

While that feature is not available, the authentication to the repository permissions endpoints are username and app password. One alternative is to create a new account to act as a "bot account" under which you can create the app password, so the password is not attached a an actual user account.

Thank you, @Sachin !

Patrik S

Sachin
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!
October 29, 2023

Thank you for the update, Pratik.

I have voted the same. 

Like Patrik S likes this

Suggest an answer

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

Atlassian Community Events