Forums

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

CURL with access token is not working to fetch bitbucket branches

Hbandhu
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!
December 31, 2019

I am writing a CURL in groovy script to fetch the branches in a repository, the initials URL ( access token is working but the second URL to fetch the branches for repo is not working . 

1st CURL to get the access token :

1.PNG

 

When i use the access token and execute the second URL , its says "Access denied. You must have write or admin access". 

 

2.PNG

 

Can you please let me know, how to solve the issue. Thanks in Advance

 

 

 

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 3, 2020

Hi @Hbandhu, welcome to the Community!

I'm assuming that you pasted the access token correctly and that the URL you're using is the correct one. To confirm this, you could use the same access token with a different URL and check the results. You could also let us know the URL you're using so we can check if it's right.

I can see in your screenshot that you have changed the  Authorization: Bearer {access_token} for  Authorization: token {access_token}.Can you change it back to Bearer as recommended in our documentation and let us know if it works?

For troubleshooting purposes, if after having tried the above you're still having issues, you could try to use a different request, as per the documentation at Oauth on Bitbucket Cloud

  1. Send it in a request header: Authorization: Bearer {access_token}
  2. Include it in a (application/x-www-form-urlencoded) POST body as access_token={access_token}
  3. Put in the query string of a non-POST: ?access_token={access_token}

Hope that helps,

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events