Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have a Django Rest Framework backend, where I make requests to from my AngularJs frontend, both are on different domains.

Currently I have the following settings in my Angular app:

//configure to work with django
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';

Not surprisingly, on any post request it returns a 403 error. I've been trying to figure this out, but have found nothing that works. What is the proper way of getting the csrf token, could it work with a mock get request just to set the csrf token as a cookie? Am I missing anything in my current settings? Or should I change how I have my project set up?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.