Gitlab + Jenkins - how to fix Error 403 No valid crumb was included in the request?

6 points
Asked by:

I try to connect Gitlab merge request webook with Jenkins and I got an error:

Error 403 No valid crumb was included in the request
Problem accessing /view/test-view/job/test-project. Reason:
No valid crumb was included in the request

What I want to achieve?

  1. I try to use Gitlab Webhooks to trigger jenkins build when new merge request is created.
  2. When jenkins build triggered by gitlab merge request webhook succeed then merge request from feature branch to master will be possible.

Everything seems fine, but I get this error when I test the merge request webhook.

What steps I've done already:

1. I've opened -> Gitlab -> my project -> Settings -> Webhooks

2. I set: URL, Secret Token and clicked on 'Add webhook' button

  • URL - url to my project on jenkins:
  • Secret Token (generated secret token in jenkins project view - this plugin is required

Entire response that I get in Gitlab:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 403 No valid crumb was included in the request</title>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /view/test-view/job/test-project. Reason:
<pre>    No valid crumb was included in the request</pre></p><hr><a href="">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>


How to fix this problem?

1 answer
8 points
Answered by:

Found solution by myself.

It was pretty simple.

I needed to modify URL from /job/ to /project/ from:


After we install jenkins gitlab plugin:

This plugin has it's own REST API which is integrated with jenkins. And this REST API looks like this:


We can read more here: 

Configuring per-project authentication

If you want to create separate authentication credentials for each Jenkins job:

  1. In the configuration of your Jenkins job, in the GitLab configuration section, click 'Advanced'
  2. Click the 'Generate' button under the 'Secret Token' field
  3. Copy the resulting token, and save the job configuration
  4. In GitLab, create a webhook for your project, enter the trigger URL (e.g. https://JENKINS_URL/project/YOUR_JOB) and paste the token in the Secret Token field
  5. After you add the webhook, click the 'Test' button, and it should succeed
Zahid Asim
Hi &#64;Root-ssh - I am having same problem as you mentioned. I am not understanding this point I needed to modify URL from /job/ to /project/ from: to: Can you please mention how to change /job/... to /project/....please? I didn&#39;t find any setting where I can instruct Jenkins to not use /job/ identifier and use /project/ in jobs URL?
Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂