hot to git clone with oauth? how to create token for this kind of use? Edited

Is not clear here... how to create the access token,

Any help is appreciated.

1 answer

0 votes

Hi Dennis, cloning with OAuth looks like:

$ git clone https://x-token-auth:{access_token}

The string x-token-auth is required as a substitute for the username.

OAuth needs a key and secret, which together are know as an OAuth consumer. To create a consumer, do the following:

  1. In your Bitbucket account, navigate to your avatar in the bottom left and click Bitbucket settings.
  2. In the left navigation panel, click OAuth > Add consumer.  
    The system will ask you for name, description, callback URL and URL.

  3. Click Save. The system generates a key and a secret for you.
  4. Toggle the consumer name to see the generated Key and Secret value for your consumer.

Let us know if you have any more questions or if you're stuck somewhere.

Best regards,


what should we do with that Key and Secret then ? in the URL you are talking about access_token and then you are giving us Key and Secret ?

The best would be if you can make a example URL of how it looks like


An excessive incomplete @Ana Retamal Ortiz's answer.

The OAuth credentials are easy to create, but the auth_token is what you have never touched.

@Amir Koklanfor generating the token you can use your consumer key as key in the following address:{key}&response_type=token

It will ask you for permissions according what you have chosen on creating the consumer.

In the URL you will find the access token that you can use later in

git clone https://x-token-auth:{access_token}

Can you please explain how to access that URL?  I am new to this and I am trying to build a script that declines a PR but I need the OAuth.  I have the key and secret how to I use that URL to get the token?

Is mandatory to create the OAuth2 credentials accessing to your accout.

Follow the steps in


The callback URL can be any URL; you can use


When you call{key}&response_type=token (the key value for client_id is your OAuth consumer key), you will find the callback url with the params sent by BitBucket. One of these params is the access token.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

679 views 5 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you