-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Example of what to pass for CSRF client argument for node.js #406
Comments
@dmg46664 Hi Daniel, Please see the README Getting Started section - it includes info on CSRF. Would suggest searching the README in general for "csrf" - since there's a few different places that CSRF is discussed. Hope that helps! Cheers :-) |
I looked at the example on the readme.
This code will fail for node.js as there is no DOM for Anything on the page relating to CSRF and middleware isn't relevant for me as I'm not running a server.
Please suggest where else I'm supposed to look? |
CSRF is only related to interaction in the browser based on my understanding. |
Hi Daniel, can you explain in a little more detail exactly what you're doing and what error you're seeing?
What is your Sente client meant to connect to? If CSRF isn't relevant for your use-case, it should be possible to disable the CSRF checks as per the API docs here and here, i.e.:
It's very possible I'm misunderstanding something about your use case though. |
@ptaoussanis I can't see where it states you can pass a In fact it's under the |
Apologies for the confusion, I use the convention that :csrf-token-fn ; ?(fn [ring-req]) -> CSRF-token for Ajax POSTs and WS handshake.
; CSRF check will be skipped iff nil (NOT RECOMMENDED!). Can definitely see that that could be confusing. Still, it would be helpful to know what error you're seeing to help rule out any issue on Sente's end. |
Just updated docstrings on master, hope that's better? |
Great! Clear! Thanks 👍 |
The node js example is from 1.11.0
https://github.com/theasp/sente-nodejs-example/blob/master/project.clj#L20
The API now insists on a CSRF argument for the client:
https://github.com/ptaoussanis/sente/blob/master/src/taoensso/sente.cljc#L1670
What are you supposed to pass here? nil? I'm getting other errors and unsure if this is the issue.
I am migrating client code from https://www.npmjs.com/package/ws (their api and core.async) and they don't insist on passing any equivalent argument.
Thanks.
The text was updated successfully, but these errors were encountered: