It is possible to get all user repositories using Bitbucket API 2.0 including private repositories? When I use https://api.bitbucket.org/2.0/repositories/{username} i got only public.
Asked
Active
Viewed 6,203 times
7
-
According to the docs this will return all repositories owned by the specified account. Are you definitely the owner of the repositories, if not you could try setting the role parameter appropriately. – c3st7n May 19 '17 at 12:10
2 Answers
6
Resolved, just have to get access token from bitbucket and send GET to https://api.bitbucket.org/2.0/repositories with Authorization: Bearer {YOUR ACCESS TOKEN}.

Łukasz Strzałka
- 131
- 1
- 4
-
1How do you generate your access token? I find a explanation for ouath 2 but where do I find my client_id and the secret? See https://developer.atlassian.com/cloud/bitbucket/oauth-2/ – kuzdu Oct 11 '18 at 12:05
-
1@kuzdu: You need to create a consumer as described in https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html The `client_id` is the Key of the consumer and the `secret` is the Secret of the consumer. – eugenk Oct 11 '18 at 13:05
1
Because I got stuck, here a little complement @Łukasz Strzałka post.
To get an access token you have to create a consumer. It's described here https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html (Thanks @Łukasz Strzałka)
You have to go to your Team Account: Click on your user icon -> choose your Team -> Settings -> OAuth
Add a consumer. The minimum is to set a title and a callback URL. Then you will get a key and a secret.
curl in terminal
curl -X POST -u "your_key:your_secret" \
https://bitbucket.org/site/oauth2/access_token -d grant_type=password \
-d username={username} -d password={password}
The response should be a token.

kuzdu
- 7,124
- 1
- 51
- 69