I am building a web app using spring security and thymeleaf, I got it work with login and logout, but I have some issues when I try to register as an end user.
(我正在使用Spring Security和thymeleaf构建一个Web应用程序,可以通过登录和注销使用它,但是在尝试注册为最终用户时遇到了一些问题。)
I am getting an invalid csrf token error. (我收到无效的csrf令牌错误。)
I am new to this, and I could use some help. (我对此并不陌生,可以寻求帮助。)
My question is how can I attach a token to that request?(Post /registration) By the way I haven't used any XML, I use annotations. (我的问题是如何将令牌附加到该请求?(发布/注册)我没有使用任何XML,而是使用了注释。)
This is the request
(这是要求)
$scope.registerUser = function() {
$http.post(BASE_URL + "/registration", $scope.registrationRequest).
success(function (data, status, headers, config) {
$log.info("Success: " + headers('Location'));
$scope.hasRegistered = true;
}).error(function(data, status, headers, config) {
$scope.hasRegisterErrors = true;
$log.info("Error: status =" + status + ", body =" + JSON.stringify(data));
});
}
And the error
(和错误)
Error: status =403, body ={"timestamp":1430645356572,"status":403,"error":"Forbidden","message":"Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'.","path":"/registration"}
ask by SavvasM translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…