I'm working with a Django (version 4.0+) application and facing a CSRF verification issue when trying to make a POST request using Hoppscotch. I'm receiving the following error:
{"detail": "CSRF Failed: CSRF token missing."}
Here's the JSON body of my POST request:
{"title": "Fiestaaaaaaaaaaaaaaaaaaaaaaaa","description": "Para celebrar","date": "2023-11-28T01:16:10Z","location": "En mi casa"}
I understand that I need to include a CSRF token in my request headers, but I'm not sure how to obtain this token when using Hoppscotch. I've made a GET request to my server expecting to see a csrftoken
cookie that I can use for subsequent POST requests, but I couldn't find it in the response headers. Here are the response headers I received:
allow: GET, POST, HEAD, OPTIONScontent-length: 141content-type: application/json... (other headers)
No Set-Cookie
header appears with the CSRF token. Is there a specific way to configure Hoppscotch or Django to make this work? I'm lost on how to proceed with CSRF tokens in this environment.
Any advice or guidance would be greatly appreciated.
Thank you in advance.