Re: CSRF Token Help

2014-06-16 Thread Andreas Kuhne
The cookie is set via the django.middleware.csrf.CsrfViewMiddleware middleware. It does all of the handling for csrf tokens. It has to be included in your middleware classes. Also the order of the middleware classes are important (at least some of my middleware didn't work if it wasn't in the corre

Re: CSRF Token Help

2014-06-15 Thread Jesse Warden
How does the cookie get set initially? If you just make one login request, is it the first OPTIONS pre-flight that sets the cookie or is it ok to be null until you successfully login? On Sunday, June 15, 2014 3:14:21 PM UTC-4, Andréas Kühne wrote: > > Hi Jesse, > > I can't remember where I saw i

Re: CSRF Token Help

2014-06-15 Thread Andreas Kuhne
Hi Jesse, I can't remember where I saw it, but I found that the csrf token is added as a cookie to the response, so it is always present on each response. In my code I have an event handler (I'm using jquery to post) that looks like the following: $(document).ajaxSend(function (event, jqxhr,

Re: CSRF Token Help

2014-06-15 Thread Jesse Warden
Yes, I've added the token in the cookie. Yes, I've added the cookie in the form post variable. Yes, I've added as a GET post variable. Yes, I've tried adding as a POST variable. Yes, I've set it to what the server sends back. Yes, I've set it to what the server-side sends back as a Cookie. ...

Re: CSRF Token Help

2014-06-15 Thread Renato Oliveira
Since you've been trying for so long, may be a obvious answer, but have you tried with this? https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax Renato Oliveira @_renatooliveira Labcodes - www.labcodes.com.br On Sun, Jun 15, 2014 at 11:38 AM, Jesse

CSRF Token Help

2014-06-15 Thread Jesse Warden
I've read the stack overflow posts, blog articles on how CSRF works, etc, but still failing to get this to work in both JavaScript and Dart. No matter what I try, I keep getting a 403 for my login method. I've attempted various Apache/Virtual Host programs for Mac to run a local domain in hopes