Angular JS Verify CSRF Token in POST Request

前端 未结 3 1821
南笙
南笙 2021-01-29 22:53

I am using AngularJS with Rails. I have the following request which updates users in bulk.

 $http{
    method: \'POST\',
    url: $scope.update_url,
    params:          


        
3条回答
  •  耶瑟儿~
    2021-01-29 23:31

    I recently faced the same issue and adding the gem angular_rails_js solved it. To my understanding it creates for every rails controller a cookie with the rails CSRF-TOKEN that will be catch (default $http behaviour) by angular $http.

提交回复
热议问题