CSRF from angularjs

0

How do I make a request to a web services that requires CSRF?

I have this service:

  app.service('Names', function($resource, $httpParamSerializerJQLike) {
return $resource('http://datos.24x7.cl/get_generic_ajax/', null,
  {
    'getAll': { method:'POST',
                headers : {"Content-Type": "application/x-www-form-urlencoded"},
                transformRequest: function(data) {
                  return $httpParamSerializerJQLike(data);
          }}
  });

})

and the controller in charge of executing the request is this:

          Names.getAll({

        csrfmiddlewaretoken: 'x7g7Yk4iLf76uW9AbMge5lJtbuFDzw7x',
        entrada: 'juan carlos'

      }, function(response){


        $scope.datoAdquerido = response.data;
        console.log(response);

      }
      )

and the server responds with an error because it requires CSRF!

How do I send that? Greetings.

    
asked by Hernan Humaña 21.09.2016 в 17:36
source

0 answers