CSRF token not working for POST method. Works for PUT
Hello,
I'm having difficulty getting the csrf token to work for POST methods. I am using angular and setting the csrf name and value in the request payload object. It works fine for my PUT methods, but when I use POST I am receiving a 500 server internal error with zero information other than that. I have even tried including the csrf name and value into the request header with no luck. The documentation is sort of vague on how to properly implement csrf tokens. I have tried writing a template with hidden inputs, but it does not seem to play nice with my angular/grunt setup on my localhost a.k.a does not appear probably due to the views in angular. I would appreciate any help that I can get.
General example of how I am using the tokens:
AuthService.getToken().then(function (token) { /////////////////////////GETS TOKEN NAME AND VALUE FINE
$scope.setToken(token);
})
$scope.newStat.csrf_name = $scope.tokenName;
$scope.newStat.csrf_value = $scope.tokenVal;
CurrentStats.post($scope.newStat).then(function (data) { //////////////THIS DOES NOT WORK-500 INTERNAL SERVER ERROR
$scope.currentStats.push(data); ///////////ALSO HAVE TRIED ADDING HIDDEN INPUT IN MAIN.HTML WITH TOKEN DATA PER EXAMPLE
$scope.switchState();
}
selectedStat.csrf_name = $scope.tokenName;
selectedStat.csrf_value = $scope.tokenVal;
console.log(selectedStat);
selectedStat.put(); //////////////////THIS PUT METHOD WORKS FINE BY ATTACHING NAME AND VAL TO REQUEST OBJ
Thank you,
Michael
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by sagarkhna999 on 09 May, 2016 10:52 AM
good Touch the Pen switch to look at the color slider. http://snapchattrophiess.com/snapchat-night-mode-and-flash-trophy/ the display screen with another ring finger to transition between surveillance cameras. nice.
2 Posted by dhoni on 15 Nov, 2016 07:23 AM
awesome Vidmate Apk Download: Fighting to locate a very http://vidmatedownloadz.com than its rivals like Snap Tube and Television Teammate nice.
3 Posted by Gloria on 17 Feb, 2017 06:46 AM
awesome with exactly how you could shield your pc from the strike of http://www.wifikillpro.com/wifikill-apk-download-for-android-free-app versus the ARP spoofing strike you just have to check package nice.
4 Posted by cerjo on 06 Jun, 2017 10:41 AM
And also similarly, its has likewise many pros http://quickshortcutmaker.com/ You will see this choice in the "Application" or "Security" updates.
5 Posted by kuldeep on 02 Sep, 2017 07:27 AM
check this awesome guide http://forpcguide.com/ to know how to get things done
6 Posted by rebeccahickshq on 05 Oct, 2017 01:32 AM
I appreciate it!. I really like it when people get together and share ideas. Great website, continue the good work!. Either way, great web and I look forward to seeing it grow over time. Thank you so much.
http://supersmashflash-2.com |=>super smash flash 2
http://bloonstowerdefense5game.com |=>bloons tower defense 5
7 Posted by Ramesh on 26 Mar, 2018 05:05 PM
this guide is good http://multiappsforpc.com/whatsapp-for-pc-download-windows-7-8-free-computer/ and easy to use