I am attempting to script a login to a django site. I have used Chrome's Advanced REST Client to post credentials and successfully login. In theory I should be able to use jQuery to script login.
In the REST client I issued two requests:
1) GET request to retrieve a csrftoken
2) POST request with the 'csrfmiddlewaretoken' = (csrftoken from first GET)
This succeeds.
I have tried to emulate similar functionality using jQuery, however when I issue a GET via
response = $.get( 'http://site.com' )
//response.getAllResponseHeaders() does not yield a csrftoken ?
Without the csrftoken, the subsequent POST will yield a 403.