Unable to verify your data submission

Hello,

I have a view with a form that is shared with frontend and backend, this view is common folder.

Sometimes when user admin in backend try to submit the form get’s error like so: yii\web\BadRequestHttpException: Unable to verify your data submission

This only happens a few times in production and I’m not able to reproduce the problem.

Yii2 version is 2.0.15 and was not updated from previous version, it is a clean install with latest version.

The form was created with ActiveForm and I can see the _backendCSRF hidden input and _csrf-token meta tag are the same when I inspect the form.

The controller in backend and frontend have they’re own action that renders the view and saves the form.

Can someone help or give any suggestions on how to solve this?

Thank you for your time.

Check if CSRF token before and after the submit is the same or is present…(inspect html)

Often it happens when you come back from external resources or the token is changed.

Yii doesn’t find the same token before the submission and gets error