I’m currently writing a Java jenkins plugin and I’m facing a problem with stapler and Java-Javascript method bind.
My java file contains a method that I want to use in my jelly file when a button is clicked :
@JavaScriptMethod
public void method() {
...
}
var it = <st:bind value="${it}"/>
$('#Btn').click(function() {
it.method();
});
This is simple and is supposed to work but the header in the request made by stapler used “Crumb” as for the CSRF token and jenkins is expecting “Jenkins-Crumb” so I get a 403.
This stackoverflow post was the problem same as mine but is quite old and I tried renaming it by editing the request and then got a 500 with “Crumb didn’t match” (/crumbIssuer/api/json
give the same token as provided so no reasons).
I’m using Jenkins v2.452.1.
KwikKill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.