Pass Django CSRF token to Angular with CSRF_COOKIE_HTTPONLY
问题 In Django, when the CSRF_COOKIE_HTTPONLY setting is set to True, the CSRF cookie gains the httponly flag, which is desirable from a security perspective, but breaks the standard angular solution of adding this cookie to the httpProvider like so: $httpProvider.defaults.xsrfCookieName = 'csrftoken'; $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; Through Django 1.9, there was a workaround where you could just pass the cookie directly to the app by putting this in the template: <script>