Hi, I'm using the atlassian cloud api library to retrieve and create bitbucket repositories.
For the authentication, bitbucket is planning to deprecate the password and using the api_token instead.
https://id.atlassian.com/manage-profile/security/api-tokens
If I am reusing the following python snippet to instantiate the bitbucket cloud object, how do I modify it to use the api_token instead? The code is returning 401 error if I use the generated api_token as the password parameter.
from atlassian.bitbucket.cloud import Cloud
cloud = Cloud(
url=url,
username=username,
password=password # Using api_token https://id.atlassian.com/manage-profile/security/api-tokens
)
codespace = cloud.workspaces.get(workspace) # Returns 401 unauthorized for https://api.bitbucket.org/2.0/workspaces/{workspace}
I've adopted two "terms" which may or may not be official/accurate:
Authentication occurs when you put "Basic <your key>" in an Authorization header
I don't speak python, but here is the Powe Query Code:
Base_URL = P_BaseURL,
Email = P_UserEmail,
Token = P_APIToken,
LocalAPIKey = "Basic " & Binary.ToText(Text.ToBinary(Email & ":" & Token), BinaryEncoding.Base64),
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.