API: find out whether I'm authenticated (BB-5268)

Issue #4567 wontfix
Christian Specht
created an issue

I wrote a backup tool for Bitbucket repositories (Bitbucket Backup...you're featuring it on your "Explore Bitbucket" page) and I'm using the Bitbucket API to get a list of a user's repositories to backup.

My app asks the users for their username and password, and authenticates with the Bitbucket API to get their private repositories as well.

The thing is, I can't tell whether I'm authenticated or not. If the user enters the wrong password, the API returns only the public repositories, but my app can't tell that the authentication failed and that the private repositories are missing in the result.

So my app silently backs up public repositories only, and is not able display an error message to the user :-/

--> I need a way to find out whether I'm authenticated or not.

In the past I was able to tell this, because the API returned only a subset of the repository information when making a non-authenticated request. Some of the repositories' properties were only returned on authenticated requests, so I just checked one of these (//has_wiki//) and when it was missing, I displayed a "wrong password" message.

But this doesn't work anymore, apparently the API was changed because of this issue: https://bitbucket.org/site/master/issue/3439/unauthenticated-repo-api-results-lack

Comments (4)

  1. Log in to comment