Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using OAuth tokens to execute git operations against Bitbucket Server

Ali_Daw April 20, 2018

Hi

I'm developing a tool that I'd like to integrate 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 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.

I've got the OAuth flow from my tool working and can use this OAuth v1 access token to access a Bitbucket Server instances's REST API.

However, if I try to execute git commands using this OAuth v1 access token, the authentication fails.

It seems like my only alternative is to ditch OAuth completely and have users of my tool generate a personal access token and use this for both the REST API and the git operations.

So my questions are:
Is OAuth2 support for Bitbucket Server on your roadmap?
Does Bitbucket Server support executing git operations using an OAuth v1 access token?
If it does, can you give me an example of how the token is to be used in the credentials for a git operation?
If it doesn't, is my only alternative to use user-generated personal access tokens?
Is this documented in detail anywhere? I've searched far and wide and found very little.

Thanks

1 answer

0 votes
Daniel Holmes June 19, 2018

I'm just reaching a point in my environment of needing answers to similar questions regarding OAuth.

I did find this discussion which may help a bit.  https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-Server-OAuth-creates-new-access-tokens-each-time/qaq-p/733683

Ali_Daw June 20, 2018

Thanks Daniel. I ended up using an Application Link / OAuth flow to initiate the connection then used that to hit the API to generate a personal access token which I could then use to do git operations. It's quite a roundabout way of achieving something that would be simple if we could use OAuth2.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events