-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing a CSRF token in the request header #70
Comments
Hi There, Huh, seems like it should "just work" with rails forms, unless we aren't including hidden inputs properly.... |
If you're not using form submissions, you can insert the CSRF token into all htmx requests with a bit of JS. Here's what I have in a Django template:
|
Thanks for your reply. |
I'm afraid the best advice I can give is to enable logging (https://htmx.org/docs#events). This may help us see if the events are getting gobbled up by some other handler. Maybe someone else has more insight. |
Hey fdeage, I have added another plugin that does something similar to what you want here: That code should definitely work for what you are trying to do. |
Thanks @chg20, I'll give it a try! |
@mblayman For Django, I just wanted to add, this code snippet should be placed at the end of |
It probably should be |
For any future readers, I was running into a problem where I was using hx-delete and got |
@1cg would it make sense to add a sentence or two to the docs? |
Hey, really like HTMX, nice job!
However I can't figure out how to pass my CSRF token in the request headers (or to actually configure headers at all).
It's strange because I used intercooler before, and I never had a missing CSRF token...
EDIT: I'm using Elixir/Phoenix
The text was updated successfully, but these errors were encountered: