Forums

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

Is there an API endpoint to generate a repository's security access token?

Dean Christian Armada August 12, 2024

Hello,

 

I tried the python snippet below however, it returned 'This endpoint does not support token-based authentication'.

 

import json

import requests




access_token = "sample_token"

workspace = "sample_workspace"

repo_name = "sample_repo"

url = f"https://api.bitbucket.org/internal/repositories/{workspace}/{repo_name}/access-tokens"

headers = { "Accept": "application/json", "Content-Type": "application/json", "Authorization": f"Bearer {access_token}" }

payload = json.dumps({ "name": "Test2", "scopes": ["webhook", "pipeline", "pipeline:write", "pipeline:variable", "runner:write"] })

response = requests.request( "POST", url, data=payload, headers=headers )

 

My general intention is for automation. I would like to avoid doing manual work for setting-up a bitbucket pipeline workflow where in the process it will trigger another pipeline on another repo from a particular bitbucket pipeline using `pipe: atlassian/trigger-pipeline` where the authorization that will be used is `BITBUCKET_ACCESS_TOKEN`.

 

Regards,

2 answers

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 14, 2024

Hi and welcome to the community!

As Aron said, this is not possible at the moment. We have a feature request for the ability to manage access tokens via API:

You can add your vote (by selecting the Vote for this issue link) to express your interest and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to be notified via email on updates.

Kind regards,
Theodora

Dean Christian Armada August 14, 2024

Okay thanks!

Like Theodora Boudale likes this
2 votes
Aron Gombas _Midori_
Community Champion
August 12, 2024

@Dean Christian Armada I think, similarly to the Atlassian API tokens, these cannot be created through the API, because that would reduce their level of security.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events