Bitbucket-Jenkins webhook giving 403 error

I have added bitbucket webhook for jenkins integration in my repository settings but it is returning 403 error. The webhook URL is provided in the following format:

https://username:apitoken@jenkins-url/bitbucket-hook/

The username provided also have admin access in Jenkins still it is giving :

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /bitbucket-hook/
on this server.<br />
</p>
</body></html>
 

I have tried all the combinations like username:password instead of API token but it is throwing error in all conditions.

Just  to let you know that Jenkins can successfully pull the code from bitbucket when the job is triggered manually.

2 answers

I have this problem as well, please advise.

0 vote

The 403 status is actually pretty descriptive here: it means that user doesn't have permission to that endpoint (/bitbucket-hook). The network is fine (otherwise you would get a NET_ERR), and the credentials themselves are OK (otherwise you would get a 401), and there's an endpoint by that name (otherwise you would get a 404), but the user in question is just not allowed to do that action.

You should examine the listener's configuration on Jenkins - that's where the issue appears to be. Look especially for user permissions.

I've used both privileged and non privileged users and every time I get the 403.

In my case, I'm able to use the same url (https://username:apitoken@jenkins-url/webhook-url-params/) in an older version of GitLab and the webhook works.

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
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

26,123 views 26 12
Join discussion

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