Hi,
Check the docs link. This will be useful. All the best
On Thu, Oct 1, 2020 at 5:10 AM Alexandro Gonçalves Dos Santos <alexandrogonsan@gmail.com> wrote:
I am building a django api to be used in a front end of another server, how do I send the csrf token and how do I retrieve it in the front end with javascript?Currently my posts.py file looks like this:```pythonfrom django.http import HttpResponsefrom django.views.decorators.csrf import ensure_csrf_cookie@ensure_csrf_cookiedef index(request):return HttpResponse('ok')```And the header that the javascript receives when making the request is:```content-length: 2content-type: text/html; charset=utf-8date: Wed, 30 Sep 2020 22:37:40 GMTserver: WSGIServer/0.2 CPython/3.7.3vary: Cookiex-content-type-options: nosniffx-frame-options: DENY```Thank you so much for your help.--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fd412572-d35c-460e-934f-6fb684d1c0c9n%40googlegroups.com.
Thanks and Regards
J. Ranga Bharath
cell: 9110334114
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m316v0c_cZ7E%3DKEWDieJ-f1N2bsUoB57r%3DuafAFWKdhodPg%40mail.gmail.com.
No comments:
Post a Comment