From 0ad90b80efa363b47d911811ac6a361b65d62774 Mon Sep 17 00:00:00 2001 From: Chris Franklin Date: Sun, 26 Oct 2014 11:34:36 +0000 Subject: [PATCH] Add support for authenticated requests This uses cookies to store a token for token_authentication as described in the django-restframework documentation. This can be used with angular-django-registration-auth and django-rest-auth which makes it easy to integrate Angular and Django. --- angular-django-rest-resource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-django-rest-resource.js b/angular-django-rest-resource.js index d1d8f6b..d624efe 100644 --- a/angular-django-rest-resource.js +++ b/angular-django-rest-resource.js @@ -316,7 +316,7 @@ angular.module('djangoRESTResources', ['ng']). } var value = this instanceof DjangoRESTResource ? this : (action.isArray ? [] : new DjangoRESTResource(data)); - var httpConfig = {}, + var httpConfig = {headers: {'Authorization': 'Token ' + $cookies['token']}}, promise; forEach(action, function(value, key) {