Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to verify your data submission exception message in Yii 2 #5808

Closed
AresD opened this issue Oct 29, 2014 · 7 comments
Closed

Unable to verify your data submission exception message in Yii 2 #5808

AresD opened this issue Oct 29, 2014 · 7 comments
Labels

Comments

@AresD
Copy link

AresD commented Oct 29, 2014

Hi!

I encounter this exception message in the following scenario:
I have adyen payment system as a payment api on my Yii 2 project and after the payment is completed, and adyen sends me back to my website I have this exception message:

2014-10-29 13:53:11 [54.72.73.155][][-][error][yii\web\HttpException:400] exception 'yii\web\BadRequestHttpException' with message 'Unable to verify your data submission.' in /var/www/clients/client1/web67/web/vendor/yiisoft/yii2/web/Controller.php:110
Stack trace:
#0 /var/www/clients/client1/web67/web/vendor/yiisoft/yii2/base/Controller.php(149): yii\web\Controller->beforeAction(Object(yii\base\InlineAction))
#1 /var/www/clients/client1/web67/web/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('call', Array)
#2 /var/www/clients/client1/web67/web/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('rpc_server/rpc/...', Array)
#3 /var/www/clients/client1/web67/web/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#4 /var/www/clients/client1/web67/web/web/index.php(12): yii\base\Application->run()
#5 {main}

2014-10-29 13:53:11 [54.72.73.155][][-][info][application] $_POST = [
'module' => 'order'
'action' => 'UpdatePaymentStatus'
'parameters' => [
'order_id' => '32'
'last_payment_status_id' => '2'
'amount' => '5'
'reason_id' => '2'
'no_capture' => '0'
]
]

I have a module named orders and adyen returns me to app/modules/orders/views/default/success.php with this:
merchantReference=3937&skinCode=epLSsdRs&shopperLocale=en&paymentMethod=visa&authResult=AUTHORISED&pspReference=54112541241&merchantSig=cKdpSDSGdwe4MzQEcXtV%2BhpA7I%3D

in the URL. I do not have to process this, actually I don't need that, it's just something adyen returns for back end processing. And it is not the topic of our subject. The point is, that upon redirecting from the adyen website to my project, I just get a blank page. And the logs show me the above message.

I don't understand how to fix it and I already tried to add the line "" in the head like this:

head
meta charset="charset ?>"/
meta name="viewport" content="width=device-width, initial-scale=1"

<title>title) ?></title>
head() ?>
/head

please help me figure this out!

Kind regards,
Ares Draguna.

@qiangxue
Copy link
Member

In your controller class, set its enableCsrfValidation to be false to disable CSRF validation for this particular action.

@AresD
Copy link
Author

AresD commented Oct 29, 2014

how do I do this in the controller? isn't this set in app config as a
'request' => [
'enableCsrfValidation' => false,
] ?

Where would I have to place the request? I am new to Yii 2 so I am trying to figure things out still...

@qiangxue
Copy link
Member

Nope, that's application-wide setting. I meant controller action specific setting. See here: http://www.yiiframework.com/doc-2.0/guide-security-passwords.html#confirming-data-integrity

@BumbuKhan
Copy link

BumbuKhan commented Jul 4, 2016

@qiangxue it doesn't help me :-(

I have wrote

$this->enableCsrfValidation = false;

in the index action, and still getting the same error

400

@BumbuKhan
Copy link

Aliluya !!!, I have sold the problem

Just add $this->enableCsrfValidation = false; in beforeAction of your controller

something like

public function beforeAction($action) { $this->enableCsrfValidation = false; return parent::beforeAction($action); }

@RNKushwaha
Copy link

RNKushwaha commented Aug 27, 2016

I have to allow POST request from Perfect Money to my site. How to do this? Its always showing

Unable to verify your data submission

While I have added

`public function beforeAction($action) { 
     $this->enableCsrfValidation = false; 
    return parent::beforeAction($action);
 }`

Also added $this->enableCsrfValidation = false; in action of the controller. Still it doesn't work.

@yii-bot
Copy link

yii-bot commented Aug 28, 2016

This is an automated comment, triggered by adding the label question.

Please note, that the GitHub Issue Tracker is for bug reports and feature requests only.

We are happy to help you on the support forum, on IRC (#yii on freenode), or Gitter.

Please use one of the above mentioned resources to discuss the problem.
If the result of the discussion turns out that there really is a bug in the framework, feel free to
come back and provide information on how to reproduce the issue. This issue will be closed for now.

@yiisoft yiisoft locked and limited conversation to collaborators Aug 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants