1

I have a TFS build that uses a service connection to Jenkins, which contains the username and password (that connection appears to be working when I test it from TFS). The build itself uses a "Jenkins Queue Job" task, where I provide the job name and any parameters that it might need. This was working fine up until recently, when Jenkins is now returning :

Error 403 No valid crumb was included in the request</title>\n</head>\n<body><h2>HTTP ERROR 403 No valid crumb was included in the request

It looks like the connection is working, and I cannot see any way that I can provide that crumb?

evolmonster
  • 237
  • 1
  • 5
  • 16
  • Have you done Jenkins version upgrade, what do you mean by "This was working fine up until recently"? What change caused this? – K. B. Mar 28 '20 at 10:24
  • Yes it looks like Jenkins was updated by the team that manages it. To version 2.228? – evolmonster Mar 29 '20 at 12:07

2 Answers2

5

We had similar issue after upgrade from 2.94 to 2.201.

From https://support.cloudbees.com/hc/en-us/articles/219257077-CSRF-Protection-Explained:

If you authenticate your API calls with a username and a user API token then a crumb is not required from Jenkins 2.96

Our solution was:
1. Jenkins admin had to generate API token for the user in TFS;
2. Then someone with enough permissions for TFS services endpoints had to replace this user password with the API token (figure 9 here).

K. B.
  • 3,342
  • 3
  • 19
  • 32
  • 2
    For steps on how to generate API tokens on Jenkins: https://stackoverflow.com/questions/45466090/how-to-get-the-api-token-for-jenkins – ShannonS May 04 '20 at 19:10
4

Your issue may be caused by CSRF protection in Jenkins Server. You may try the solution in case Jenkins 2.192: HTTP Error 403: No valid crumb was included in the request:

  1. Install the Strict Crumb Issuer plugin (https://plugins.jenkins.io/strict-crumb-issuer/)
  2. Enable this plugin and uncheck 'Check the session ID' from its configuration (Under Jenkins Configure Global Security)
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39