2

I have enabled CSRF in main.php

'request' => array(
    'enableCsrfValidation' => true,      
)

After enabling CSRF, all the links in my app are showing 400 (Bad Request). I have tried searching for the fix and did not find any. Am i missing anything? I am using YII 1.16

Tomasz Jakub Rup
  • 10,502
  • 7
  • 48
  • 49
Hema Chandra
  • 80
  • 1
  • 11

1 Answers1

0

Do you have a session started? The Yii-CSRF-Token is stored in the session

400 is the default error thrown by Yii if the token is invalid.

If you want to check more closely look at CHttpRequest.php -> validateCsrfToken

LaSchmu
  • 11
  • 2
  • I was able to fix it myself. In ValidateCsrfToken function, i added one exit() after $valid = false; I am not sure if it is correct way – Hema Chandra Dec 01 '15 at 15:53