I’m developing a tool that integrates with Bitbucket Server.
Ideally, users of my tool should be able to go through the OAuth flow against a Bitbucket Server instance (having already set up an application link to my tool) to obtain an OAuth access token.
From within my tool, users should then be able to execute operations against a Bitbucket Server instance’s REST API and execute git operations (eg.
git clone https://mybitbucketserver:7990/scm/proj/repo1.git) using that access token.
The access tokens I’m generating are OAuth v1 because (as far as I can tell) Bitbucket Server doesn’t support OAuth2.
Since it’s not possible to use OAuth v1 tokens to execute git operations, I then need to add a personal access token via Bitbucket Server’s API and use that for the git operations.
To generate this personal access token via the API, I need to know the username of the user for which I have an OAuth token.
I’ve been unable to find a Bitbucket Server API endpoint that will return the username for the currently authorised user (similar to Jira’s
/rest/api/2/myself). I opened a support request before posting here and they confirmed that one does not exist for Bitbucket Server.
How do you recommend I integrate my tool with Bitbucket Server? Is there a simpler method that I’ve missed?
I’ve purposefully avoided requesting users for their username because to me, the whole point of OAuth is to avoid collecting usernames and passwords (not to mention some users inevitably submitting an incorrect username).