Issue #7888
Can't update Fields through Rest API We pages (PUT requests)
Description
Using rest api on pulp (PUT Request), I current Get the following error raised
{ "detail": "CSRF Failed: CSRF token missing or incorrect." }
Investigation¶
-
The root cause of this issue comes from the X-CRRFToken been checked but not sent through the Ajax Call
-
Source of this check comes from the authentication scheme in place (SessionAuthentication) (cf settings.py) 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.BasicAuthentication', ]
Associated revisions
History
#3
Updated by dkliban@redhat.com 3 months ago
Does this occur when using the browsable API provided using django rest framework?
#4
Updated by equipe_serveurs@exane.com 3 months ago
Yes it is indeed the case. This case is about using the API through the web interface.
#5
Updated by Anonymous 3 months ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|1e256df214451a80a381955a262609c6e8e65035.
Please register to edit this issue
Define window.drf.csrfToken in api.html
This variable is expected in csrf.js to get the X-CSRFToken / csrfHeaderName to be set.
If not http PUT on form update won't work.
Fixes: #7888