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

How to use token with Bitbucket server REST API?

Parth Shah October 4, 2017

Hello,

I'm trying to trigger a jenkins job to create branches with jenkins plugin from bitbucket which makes use of bitbucket server rest api. With that said, curl script uses basic auth as -u user:pass, so is there a way that I can use bitbucket token api instead to trigger the job?

 

Thanks in advance.

 

-Parth

1 answer

1 vote
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 4, 2017

Hi! 

 

Which bitbucket are you using? 

For cloud version see below: 

https://legacy-developer.atlassian.com/blog/2016/02/bitbucket-oauth-with-python/

 

Thanks

Julius Davies _bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2017

I think he's on Bitbucket Server.

For Bitbucket Server (or Datacentre), try installing the free Token Authenticator add-on.  Then you can use X-Auth-User and X-Auth-Token HTTP headers.  You need both.

Parth Shah December 21, 2017

@Julius Davies _bit-booster_com_Thanks for your suggestion. Actually it does work when I try to place the generated token under the request, but not remotely.

What I'm doing is - Triggering a jenkins build from bitbucket and asking user to enter some parameters. Once the job is success it will create PR from specified branch (user parameters) to base branch. At this point I don't want user to enter password and neither I can use Token. Do you have any other recommendation?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events