Project

Profile

Help

Issue #7888

closed

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

Added by equipe_serveurs@exane.com about 4 years ago. Updated almost 4 years 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', ]

Actions #1

Updated by pulpbot about 4 years ago

  • Status changed from NEW to POST
Actions #2

Updated by fao89 about 4 years ago

  • Triaged changed from No to Yes
Actions #3

Updated by dkliban@redhat.com almost 4 years ago

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

Actions #4

Updated by equipe_serveurs@exane.com almost 4 years ago

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

Added by Frederic Brin almost 4 years ago

Revision 1e256df2 | View on GitHub

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

Actions #5

Updated by Anonymous almost 4 years ago

  • Status changed from POST to MODIFIED

Added by bmbouter almost 4 years ago

Revision 66675485 | View on GitHub

Move changelog to correct folder.

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

re #7888

Actions #7

Updated by ttereshc almost 4 years ago

  • Sprint/Milestone set to 3.10.0
Actions #8

Updated by pulpbot almost 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF