A
A
Alexander Sharomet2017-03-17 20:45:01
Yii
Alexander Sharomet, 2017-03-17 20:45:01

Why is csrf cookie not always created in yii2?

The problem is that when I clear cookies, the csrf of the cookie is not saved, but if I switch to the standard layout, the cookie is saved and then I switch to my layout and everything works.
I've added the csrf meta.
Layout files are the same.
Php-7
OpenServer
Mongodb
What could be the problem? thank.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2017-03-19
@sharomet

such a problem may arise due to the absence of $this->beginPage() in the layout or the output of csrf meta tags <?= Html::csrfMetaTags() ?>

S
Shamsudin Serderov, 2017-03-17
@Steein

Isn't the CSRF Token stored in the session?
According to the rules of CSRF, the Token is stored in the session, and every time the pages are updated, it changes the key.
Link Yii2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question