3

Got a weird scenario. I am on the Django Rest browser api with a logged in user. When I update it is okay. But when I try to create a user, this error shows:

CSRF Failed: CSRF token missing or incorrect.

it also auto logged out me every single time.

In views.py, I already have added

permission_classes = (permissions.IsAuthenticatedOrReadOnly,)

Still same error and scenario. In my settings.py:

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.SessionAuthentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.AllowAny',
    ],
}

Anyone experienced this?

Bazinga
  • 2,456
  • 33
  • 76

0 Answers0