I have an endpoint which is supposed to work like an API:
/reset/<ID>
This will be called via ajax/angular from a separate client (CORS issues already addressed).
Now, if I just publish the endpoint in urls.py
, I get an error:
403 Forbidden
CSRF verification failed. Request aborted.
The reasons are clear to me.
So I investigated and found this @csrf_exempt decorator. With it, it works...but is it ok to do it like this?
The request does not follow a request-response cycle, the client may send this reset at any time - so I would not know how to send the X-CSRF-Token
header to the client...so maybe in the end it's the only way to go?