Jenkins RestAPI调用出现Error 403 No valid crumb was included in the request

Posted imzye

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jenkins RestAPI调用出现Error 403 No valid crumb was included in the request相关的知识,希望对你有一定的参考价值。

方法一(不推荐):

在jenkins 的Configure Global Security下 , 取消“防止跨站点请求伪造(Prevent Cross Site Request Forgery exploits)”的勾选

 

方法二:

1、获取用户API token

http://Jenkins_IP:8080/user/zhangyi/configure

点击 show API Token,假设是API_TOKEN

2、计算CRUMB

CRUMB=$(curl -s http://USER:[email protected]_IP:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb))

3、请求时附带CRUMB信息即可

curl -X POST -H "$CRUMB" http://USER:[email protected]:8080/reload

 

以上是关于Jenkins RestAPI调用出现Error 403 No valid crumb was included in the request的主要内容,如果未能解决你的问题,请参考以下文章