在向Jenkins發送請求時收到了這樣的403錯誤信息:
No valid crumb was included in the request
后來通過google找到了解決方案。
http://stackoverflow.com/questions/38137760/jenkins-rest-api-create-job
- 1
我們使用的Jenkins的版本是2.4。
在系統管理 –> Configure Global Security中調整設置:
取消“啟用安全(Enable security)”的勾選;
取消“防止跨站點請求偽造(Prevent Cross Site Request Forgery exploits)”的勾選。
結果如下圖:
就這樣!
第一步不要執行了。我被誤導了,最后丟失了用戶權限系統。只需要執行第二步就可以。如果還堅持要啟用“防止跨站點請求偽造”,需要先動態獲取crumb。可以參考Jenkins wiki中《CSRF Protection》一節。
參考博客地址:http://blog.csdn.net/dream_flying_bj/article/details/56057300