How to handle HTMX Requests updating then csrf token.
I am trying to see how well HTMX works with laravel blade. Out of the box it's hasn't been a bad experience. I have been able to write a login page, registration page, est with HTMX without an issue.
The Issue I am running into is if there are multiple forms / requests on the same page I am getting the 419 page expired message. The reason from my research I am getting is because the server is getting the request from the first form/request submitted and is changing the CSRF token server side. Since HTMX only sends back the html response that is needed the updated csrf token is not being included in any other HTMX requests unless I refresh the page. (Refreshing the page or returning the whole page would be counterintuitive to using HTMX)
There are HTMX extensions that update the "head" of a page. I could use that to update a meta tag for the csrf token. I'm not sure what, if any security vulnerabilities with happen with this approach.
Any suggestions on how to handle this? I don't wan't to refresh the page or load the entire page again because it would be counterintuitive to using HTMX.
Please or to participate in this conversation.