Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,551,971
Community Members
 
Community Events
184
Community Groups

get refresh token code fails

curl -X GET https://bitbucket.org/site/oauth2/authorize?client_id={my_client_id}&response_type=code

I use my own client_id above. 

get refresh token code fails. There is no output. Even if I do -o output.txt

 

If I take this string and put in a browser I get the code. (fails using curl)

I need this automated using curl. 

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 29, 2021

Hi David,

This code needs to be obtained from the browser, it is not possible to get it with curl. Please note though that this needs to be done once when you set up OAuth. Also, the call to get refresh tokens is different and you can use curl for that.

After you use this in a browser and get a code

https://bitbucket.org/site/oauth2/authorize?client_id={consumer_key}&response_type=code

then you can get an access token and a refresh token with a call like this:

curl -X POST -u "key:secret" https://bitbucket.org/site/oauth2/access_token -d grant_type=authorization_code -d code=huPPKResiPcsLaqjj4
Replace key with your consumer's key
Replace secret with the consumer's secret
Replace the code value in there (huPPKResiPcsLaqjj4) with your code from the previous step

The output will include an access token you can use for up to 2 hours and a refresh token.

You can then use the refresh token to generate a new access token and refresh token with the following call:

curl -X POST -u "key:secret" https://bitbucket.org/site/oauth2/access_token -d grant_type=refresh_token -d refresh_token={2Eoiw6UJ707AD9aIyUR}
Replace key with the consumer's key
Replace secret with the consumer's secret
Replace the value of the refresh_token in there (2Eoiw6UJ707AD9aIyUR) with the one from the output of the previous curl command

This will give you another access token and refresh token. From then on, you can use the last call to generate new access and refresh tokens.

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Thank you very much for the response, I appreciate it.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 28, 2022

You are very welcome, please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events