I'm using BlazeMeter recording tool and running it on JMeter, but in my response data I'm getting CSRF token validation failed
when I try to test my web application's login page.
-
Possible issue is, you are passing that token hard coded. you need to extract the new token every time comes in GET request and store into some variable and then have to pass that variable to POST request as @Dmitri T mentioned.– NarendraRMay 14, 2018 at 11:31
1 Answer
You need to consider a different structure of your test to make it behave like a real browser:
- Open Login Page (HTTP Get Request)
- Extract
_csrf_token
value from the response and save it into a JMeter Variable
- Extract
- Perform Login (HTTP Post request). At this stage you need to provide credentials and _csrf_token from the previous request.
See How to Load Test CSRF-Protected Web Site article for more information with regards to bypassing CSRF protection in JMeter tests.