Using django with postman {“detail”:“CSRF Failed: CSRF token missing or incorrect.”}

前端 未结 7 2223
谎友^
谎友^ 2021-02-20 17:08

I\'m using postman to check json response from my django-rest-framework.

When my first try to post id, email, password through POST method to my django on AWS(amazon web

相关标签:
7条回答
  • 2021-02-20 17:34

    If using token based authentication with DRF don't forget to set it in settings.py. Otherwise you'll get a CSRF error

    REST_FRAMEWORK = {
        'DEFAULT_AUTHENTICATION_CLASSES': [
            'rest_framework.authentication.TokenAuthentication',
        ]
    }
    
    0 讨论(0)
提交回复
热议问题