Hi Team,
We are trying to fetch the license details of our Bitbucket product through API calls using Personal Access tokens.
we are getting 401 Unauthorized access error.Please find the error details.
The remote server returned an error: (401) Unauthorized.
API Used: https://bitbuckethosturl/rest/api/1.0/admin/license
I have created the token for an admin account.we are able to view the license details in the UI but when tried through API we are getting above exception.
Please let us know how we can fix this authentication issue. Let me know if anything i need to change in my settings.
Awaiting for your reply.
Thanks
Hi,
My experience with Bitbucket REST API is that personal access tokens cannot be used with administrator related REST endpoints.
I am not sure why.
So, for admin related REST endpoints basic auth may be the way to go but not ideal. I would prefer personal access tokens over basic auth.
Basic AUTH:
curl -v -X GET -u admin-username:password https://bitbuckethosturl/rest/api/1.0/admin/license
Response HTTP 200 with license info.
Personal access token:
curl -v -X GET -H "Authorization: Bearer MTQ1NTY0MDA4OTEwOtAOXXXXXXXXX" https://bitbuckethosturl/rest/api/1.0/admin/license
Response HTTP 401
Bitbucket access tokens and Bitbucket
Regards
Lasse Langhorn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.