I'm creating a web application with a Django backend, but most of the heavy lifting will be done with Javascript. I've been having a debate with some colleagues about whether or not it would be secure to generate the CSRF token with javascript instead of the Django template tag.
From the research that I've done so far, it looks like Django just compares the value set in the CSRF_COOKIE
with the value submitted in the csrfmiddlewaretoken
form field.
Is it insecure to generate a random 32 character string and set the form field value and the cookie with javascript?