# '\_Token' was not found in request data

**URL:** <https://discourse.cakephp.org/t/-token-was-not-found-in-request-data/1500>\
**Category:** Need Help\
**Created:** [November 9, 2016, 11:25pm UTC](https://discourse.cakephp.org/t/-token-was-not-found-in-request-data/1500 "2016-11-09T23:25:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CaptainBalrog](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@CaptainBalrog](https://discourse.cakephp.org/u/CaptainBalrog)\
**Post date:** [November 9, 2016, 11:25pm UTC](https://discourse.cakephp.org/t/-token-was-not-found-in-request-data/1500/1 "2016-11-09T23:25:46Z")

</div>

I’m getting this error and I’ve no idea why!

‘\_Token’ was not found in request data.

Well after following the code i know that it’s because the request data doesnt have a \_Token value

There’s a function that checks this called \_validToken()

I’ve no idea why this particular form is doing this though as other forms are working perfectly

Could use a few pointers here

Can anyone out there give me some idea what to look for?

Would be much appreciated

---

<div class="post-metadata">

**Author:** ![CaptainBalrog](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@CaptainBalrog](https://discourse.cakephp.org/u/CaptainBalrog)\
**Post date:** [November 11, 2016, 8:34am UTC](https://discourse.cakephp.org/t/-token-was-not-found-in-request-data/1500/2 "2016-11-11T08:34:35Z")

</div>

Hi

So i figured this out eventually

It was such a simple problem

I had something like this at the end of my form:

\<?= $this-\>Form-\>button(\_\_('Submit')); $this-\>Form-\>end() ; ?\>

It works. It also works when you turn on auth. But it stops working as soon as you load the security component

Change it to this:

\<?= $this-\>Form-\>button(\_\_('Submit')) ?\> \<?= $this-\>Form-\>end() ?\>

And it works with the security component

Silly mistake i suppose but hard to find because it worked fine for most if the development process and then broke when i added the security component!

---

<div class="post-metadata">

**Author:** ![chief-cook](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/chief-cook/32/479_2.png) [@chief-cook](https://discourse.cakephp.org/u/chief-cook)\
**Post date:** [November 18, 2016, 10:18pm UTC](https://discourse.cakephp.org/t/-token-was-not-found-in-request-data/1500/3 "2016-11-18T22:18:23Z")

</div>

hmm, would like to know the exact explanation of that issue.

I mean syntactically it is obviously incorrect because in the first version you practically say:

`echo statement; statement;`

maybe the second statement is just ignored then and the form just works fine as a lot of broken HTML does?

but how is it connected to the security component?

---

<div class="post-metadata">

**Author:** ![avp](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@avp](https://discourse.cakephp.org/u/avp)\
**Post date:** [August 29, 2018, 6:12am UTC](https://discourse.cakephp.org/t/-token-was-not-found-in-request-data/1500/4 "2018-08-29T06:12:04Z")

</div>

Please refer: [https://stackoverflow.com/questions/37360734/token-was-not-found-in-request-data-in-cakephp3-after-server-migration/52054949#52054949](https://stackoverflow.com/questions/37360734/token-was-not-found-in-request-data-in-cakephp3-after-server-migration/52054949#52054949)
