I am working on a project where real-time data is transmitted between the client and the server using WebSockets. For this, I am using socket.io
in the Frappe Node.js real-time service.
In my setup, I need to make API calls from the Node.js server (using WebSocket events) to the Frappe Python server. Since Frappe requires a CSRF token for secured API calls, I am exploring the best way to pass the CSRF token and use it in these scenarios.
Use the CSRF token as a request header (X-Frappe-CSRF-Token
) in API calls made from Node.js (via frappe_request
or fetch
) to the Python server.
so how can i access CSRF token in Frappe Node server ie., in “apps/frappe/realtime/handlers/frappe_handlers.js”