title: Creating a user session with AngularJS and DreamFactory
body: <p>I'm trying to make a simple login function for my AngularJS application. I'm using Dream Factory for my backend server database and I can't seem to be able to create a session from my login-function.</p>
  
  <p>This is the factory I have set up:</p>
  
  <pre><code>dfdevApp.factory('SessionService', function($resource, $q) {
    var sessionResource = $resource('https://dsp-myusername.cloud.dreamfactory.com/rest/user/session', {}, 
        { update: { method: 'PUT' }, query: {method: 'GET', isArray: false} });
    return {
      create: function (user) {
            var deferred = $q.defer();
            sessionResource.save(user, function (result) {
                deferred.resolve(result);
            }, function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        }
    }
  });
  </code></pre>
  
  <p>And this is the code from my controller:</p>
  
  <pre><code>     // $scope.ting = Liste.get()
  $scope.user = {'email' : '', 'password': ''};
  
  $scope.login = function() {
      console.log(JSON.stringify($scope.user));
  $scope.user = SessionService.create(JSON.stringify($scope.user), function(success) {
      $rootScope.loggedIn = true;
      $location.path('/');
  }, function(error) {
      $scope.loginError = true;
  });
  </code></pre>
  
  <p>};
  });</p>
  
  <p>I get a 400 every time I try to post.</p>