How to use csrf_token in Django RESTful API and React?
问题 I have previous experience in Django . If add line {csrf_token} in Django templates then Django handles the functionalities of csrf_token . But when I am trying to develop an API using Django REST Framework then I get stuck. How can I add and handle functionalities like csrf_token in API (back end, developed using Django REST Framework ) and React Native/React JS (front end) like Django templates? 回答1: The first step is to get CSRF token which can be retrieved from the Django csrftoken cookie