Hi! I'm using the example of the BitBucket API post method to create a repository
I'm using a personal token that I created on BitBucket Personal Settings > Apps Passwords with full permissions.
My user can create repositories within the UI of BitBucket, but when I run the code I got this error:
{ "error": { "message": "Token is invalid or not supported for this endpoint." }, "type": "error" }
Hi Francesco,
An app password is a type of password, it cannot be used as a Bearer access token. It needs to be used with Basic authentication along with the account's username. You can find the username of your Bitbucket account on this page (after you log in):
If you base64-encode the string username:app_password (where username and app_password should be your own values) and the base64-encoded value is xxxxxxx, you can use it in the header as follows:
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Basic xxxxxxx',
}
Just a heads up, I removed the workspace ID and project name from your post for privacy reasons.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.