I have been trying to set the crumb for triggering a Jenkins job. But it doesn't seem to work or I am doing something wrong. Here is my code:
// Use the crumb in the post call
axios.post(`${url}/job/${job_name}/build?token=${token}`,
{},
{
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Jenkins-Crumb": r.data.crumb
}
}).then(r => console.log(r))
.catch(r => console.log(r))
I keep getting the 'No valid crumb' error, I am getting the crumb from the crumbIssuer API properly. Been trying for quite some time now. Do I need the token at all, if I am using a crumb? Do I need the username/password again if I am using a token/crumb?
Please help, stuck here.