title: Postman identical request not working in angularjs http request
body: <p>I have this postman request but some how its angularjs equivalent is not working </p>
  
  <p>I want to get the response for the exact request in post man as follows.
  In postman Its giving me what I need but can't make it work in angular</p>
  
  <pre><code>var settings = {
        "async": true,
        "crossDomain": true,
        "url": "http://197.157.93.110/Apiv1/token",
        "method": "POST",
        "headers": {
          "cache-control": "no-cache",
          "postman-token": "c76c4b6a-9a69-23dd-0171-8e6cbacd7944",
          "content-type": "application/x-www-form-urlencoded"
        },
        "data": {
          "grant_type": "password",
          "UserName": "user1",
          "Password": "password"
        }
      }
  
      $.ajax(settings).done(function (response) {
        console.log(response);
      });
  </code></pre>
  
  <p>my angular code looks like this </p>
  
  <pre><code>services.factory('documentService', ['$http', function($http){
              return {
                      getToken:function(grant_type,user,password){
                          return $http({
                                  method:"POST",
                                  url:"http://197.156.93.110/Apiv1/token",
                                  headers: {
                                              "cache-control": "no-cache",
                                              "content-type": "application/x-www-form-urlencoded"
                                    },
                                  data: {
                                      "grant_type": grant_type,
                                      "UserName": user,
                                      "Password": password
                                    }         
                          });
                      }
                  ,
  </code></pre>
  
  <p>I get error Bad Request with code 400</p>
  
  <p>Am using it later at my code by calling the promise like this </p>
  
  <pre><code>documentService.getToken("password","user1","password").success(function(token){
          $scope.access_token=token.access_token;
          $scope.userName=token.userName;
          $scope.token_type=token.token_type;
          $scope.message={"message":"success"};
                  $interval(function () {
                      $scope.message = "";
                  }, 10000);
                  //call get documents if only access token is success
  
  
      }).error(function(err){
          $scope.message=err;
          $interval(function () {
              $scope.message = "";
          }, 10000);
      });
  </code></pre>