We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Strange issue with checkToken()

$this->security->checkToken() works strange. In Firefox, I need to re-send the login credentials, 'cause the first time the code before fails. In Chrome, it just fails everytime. I started having this issue a week ago more or less (two as maximum), and the code has been the same for weeks (if ($this->request->isPost() && $this->security->checkToken())).

Can anyone illuminate me?



98.9k

Try to check if a 'favicon.ico' file is missing from your document root.



33.8k

No, I haven't one. But I didn't had knowledge if it existed one in all this time.



33.8k

I marked renskii's answer as correct, but both were right. The problem was that, when I added the checkToken() function along with isPost(), I was creating a true && false situation first, where the second request was true && true (as happened to somebody in the other post). I thinked it was on the security session check I created in the beforeExecuteRoute(), but it isn't.

Well, resuming it, I created the favicon.icofile (BTW, for what it is?) and create a RedirectMatch 204 to it. But I don't get the idea of all of this.