Forums

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

I am getting auth error while trying to create a repository using REST API through python script

Manoj M
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!
September 29, 2022

I am getting AUTHENTICATION error.

headers = { "Accept": "application/json",

                        "Content-Type": "application/json",

                         "Authorization": "Bearer <access_token>"

                    }

I feel the problem is with the "access token" field.

What should I provide in this field ?

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2022

Hi @Manoj M,

If you use Bearer in Authorization you will need to set up OAuth and use the access token generated as detailed here:

Please keep in mind these access tokens expire in two hours and you will then need to use the refresh token to generate a new access token (which will have the same expiry of two hours) and a new refresh token.

Another option would be instead of Authorization: Bearer to use Authorization: Basic

Authorization: Basic some_string

some_string is constructed by first combining a Bitbucket username and an app password for that account with a colon (e.g. myUsername:dgAT6frP9Ermn) and then by encoding the resulting string in base64.

If you have any questions, please feel free to let me know.

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events