title: always getting "bad request" error in salesforce oauth 2 authentication using appcelerator
body: <p>I am able to get the access_token for the salesforce oath2. access token can expire after some time and after that we need to refresh the access token. But I am always getting "Bad Request" error in this code.</p>
  
  <pre><code>function getRefreshToken(refreshToken) {
      var url = loginUrl + 'token';
      var client = Ti.Network.createHTTPClient({
  
          // // function called when the response data is available
          onload : function(e) {
              Ti.API.info("Received text: " + this.ResponseText);
              alert(this.status);
              alert(this.responseText);
  
          },
          //  function called when an error occurs, including a timeout
          onerror : function(e) {
              Ti.API.debug(e.error);
              alert(this.status);
              alert(e.error);
          },
          timeout : 5000   //in milliseconds
      });
      //Prepare the connection.
      client.open("POST", url);
      client.setRequestHeader("content-type", "application/json");
      //Send the request.
      var param = 'grant_type=refresh_token&amp;client_id=' + escape(clientId) + '&amp;client_secret='+ escape(clientSecret) + '&amp;refresh_token=' + escape(refreshToken);
      Ti.API.info(param);
      client.send(param);
  
  }
  </code></pre>
  
  <p>am I missing something in this code? expected result is a json response with new access_token.</p>