Bitbucket token is short living and expires soon. how can i get a refresh token with rest api ?
Hi!
curl -X POST -u "client_id:secret" \ https://bitbucket.org/site/oauth2/access_token \ -d grant_type=refresh_token -d refresh_token={refresh_token}
https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication#refresh-tokens
Also, it will be nice if you provide pull request regarding that in this small routine reducer project. (https://github.com/AstroMatt/atlassian-python-api)
Cheers,
Gonchik Tsymzhitov
In your browser go to https://bitbucket.org/site/oauth2/authorize?client_id={client_id}&response_type=codeAuthorize under your bitbucket account.After that, your browser will be redirected to {your_redirect_link}/?code={code}Use the code to make another request in a terminal:curl -X POST -u "{client_id:secret}" https://bitbucket.org/site/oauth2/access_token -d grant_type=authorization_code -d code={code}
The reponse will be look like that:{"access_token": "some_long_string","scopes": "team webhook account issue wiki pipeline pullrequest project snippet","expires_in": 7200,"refresh_token": "the_string_you_need","token_type": "bearer"}
Now you can refresh access_token with requestcurl -X POST -u "{client_id}:{secret}" https://bitbucket.org/site/oauth2/access_token -d grant_type=refresh_token -d refresh_token={refresh_token}
I don't think the answer explained how to get the {refresh_token} itself
Sorry if this sounds stupid but what is client_id?
I order to use bitbucker api you need to generate a client_id (also known as a key) and a secret. You can do this in your settings page in OAuth section.
How can we do this all in curl. I tied it and it fails. I do not want to use the browser. I need automation to refresh my token.
It looks like you're new here. Sign in or register to get started.