how to add csrf token on meta tag into head

alnux
Member | 139
+
0
-

hi, im start to using hotwire Turbo javascript and it detect csrf token on meta tag called csrf-token, is there any way on latte to create a token??

by example

<meta name="csrf-token" content="{csrf_token()}">
NouF
Member | 67
+
+1
-

Try look here – https://github.com/…/Helpers.php

I use nextras secured-links – check code it will help you.

Marek Bartoš
Nette Blogger | 1275
+
0
-

Is it a required thing? If not, just ignore it.

Since Nette 3 there is automated protection for modern browsers. Also for forms you can just call $form->addProtection() and it will be automatically added to the rendered form and it works well for ajax requests as well.

Btw, why Turbo? Nette had similar concept called snippets built-in for ages.

alnux
Member | 139
+
0
-

Marek Bartoš wrote:

Is it a required thing? If not, just ignore it.

Since Nette 3 there is automated protection for modern browsers. Also for forms you can just call $form->addProtection() and it will be automatically added to the rendered form and it works well for ajax requests as well.

Btw, why Turbo? Nette had similar concept called snippets built-in for ages.

Turbo together with importmap (instead of webpack or vite) because just installing it simulates a SPA app and well personally I am just getting into what SPAs are, I understand that before with webpack it was tedious and it improve with vite. but now with what I read about importmaps this type of implementation becomes more transparent. Also according to the documentation of TURBO together with STIMULOUS, the implementation of mobile apps is also less tedious. But I repeat, I am just learning this type of web apps..