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

Bitbucket webhook returning 401 from TeamCity

Neal Rodruck March 15, 2018

I'm trying to setup a webhook on bitbucket that forces a build and subsequently runs unit tests every time a PR is submitted. The request is made on the bitbucket side just fine (I can check the "View Requests" section and the calls are being made). However,
it's returning a 401 with each call, with the message in the body saying:

> Authentication Required

> To login manually go to "/login.html" page

Capture.PNG

To setup the webhook I've done the following:

- Whitelisted the bitbucket IPs as suggested on [this][2] page (outbound IPv4 column only)
- Connected bitbucket to TeamCity using the following steps:
1. Go to specific build > Edit Project Settings > Connections > Add Connection

2. Select Connection Type == Bitbucket Cloud & copy URL (not "Callback URL")
TeamCity.PNG
3. Go to Bitbucket > Settings > Add Webhook & paste the URL (not "Callback URL") from step 2 in the URL textbox
bitbucket.PNG
4. Select Triggers: Choose from a full list of triggers > Pull Request > Created
5. Went to my account > Bitbucket settings > OAuth > Add OAuth consumer
6. Added URL/Callback URL from step 2
7. Under permissions checked every "Read" box I could see (just trying to get this working)
8. Copied the Key/Secret in the TeamCity form from Step 2 (still open in another browser)

I'm able to log into the URL from Step 2 on my desktop and manually trigger a build. Also TeamCity can successfully poll bitbucket and kick off builds after a PR has been merged. Can anyone who's succesfully set this up let me know what, if anything, I'm missing?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events