1

I have created a rest api in Symfony. It uses form for the client to send the data. I have used 'csrf_protection' => false in setDefaultOptions, but still getting the error

The CSRF token is invalid. Please try to resubmit the form

Bads123
  • 879
  • 2
  • 13
  • 26

1 Answers1

0

Did you test your api over NelmioApiDocBundle sanbox, or your sending data from form on frontned side? Are you sure that your not sending csrf_protection requsest parameter to your api?

hd.deman
  • 1,268
  • 12
  • 17
  • I am calling api from php using curl and 100% sure that csrf_protection is not sent. Here is the sample code for client $curl_post_data = json_encode($curl_post_data); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data); $curl_response = curl_exec($curl); – Bads123 Oct 15 '13 at 01:30