CSRF Failed: CSRF token missing or incorrect

前端 未结 12 963
臣服心动
臣服心动 2020-11-29 02:42

I\'m using Django 1.7 and django-rest-framework.

I made an API that returns me some JSON data putting this in my settings.py

REST_FRAMEW         


        
12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 03:22

    I think it is a cookie issue.

    Permanent Solution: If you are using Postman, First, clear the existing cookies by clicking 'X' s. Then add correct cookie.

    Temporary Solution (for debugging): Try this in your settings.py:

    'DEFAULT_AUTHENTICATION_CLASSES': [
        # 'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.BasicAuthentication',
    ]
    

提交回复
热议问题