Project

Profile

Help

Issue #7888

Can't update Fields through Rest API We pages (PUT requests)

Added by equipe_serveurs@exane.com 8 months ago. Updated 6 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Master
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Using rest api on pulp (PUT Request), I current Get the following error raised

{ "detail": "CSRF Failed: CSRF token missing or incorrect." }

Investigation

  1. The root cause of this issue comes from the X-CRRFToken been checked but not sent through the Ajax Call

  2. 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

Revision 1e256df2 View on GitHub
Added by Frederic Brin 6 months ago

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

Revision 66675485 View on GitHub
Added by bmbouter 6 months ago

Move changelog to correct folder.

Also line-wrap to 100 chars per the Pulp style guide.

re #7888

History

#1 Updated by pulpbot 8 months ago

  • Status changed from NEW to POST

#2 Updated by fao89 8 months ago

  • Triaged changed from No to Yes

#3 Updated by dkliban@redhat.com 7 months ago

Does this occur when using the browsable API provided using django rest framework?

#4 Updated by equipe_serveurs@exane.com 7 months ago

Yes it is indeed the case. This case is about using the API through the web interface.

#5 Updated by Anonymous 6 months ago

  • Status changed from POST to MODIFIED

#7 Updated by ttereshc 6 months ago

  • Sprint/Milestone set to 3.10.0

#8 Updated by pulpbot 6 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF