How to use token with Bitbucket server REST API?

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 Champion Oct 04, 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

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.

@G. Sylvie 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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Confluence

Color tables for a shiny Confluence page

...; ## Developed by: Alana Fernando ## Shared with love ## @param style:title=style type|type=enum|required=true|desc=Choose a style.|enumValues=Style1,Style2,Style3,Style4,Style5 ## @param alignment:title...

144 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you