Post form data with axios in Node.js : <p>I'm testing out the Uber API on Postman, and I'm able to send a request with form data successfully. When I try to translate this request using Node.js and the axios library I get an error. </p>

<p>Here is what my Postman request looks like:</p>

<p><a href="https://i.stack.imgur.com/vogec.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vogec.png" alt="Postman POST request"></a></p>

<p>The response I get is: <code>{ "error": "invalid_client" }</code></p>

<p>Here is what I'm doing in Node.js and axios:</p>

<pre><code>var axios = require("axios");

const config = { headers: { 'Content-Type': 'multipart/form-data' } };

axios.post('https://login.uber.com/oauth/v2/token', {
  client_id: '***',
  client_secret: '***',
  grant_type: 'authorization_code',
  redirect_uri: 'http://localhost:8080/',
  code: '***'
}, config)
  .then(function(response) {
    console.log(response.data)
  })
  .catch(function(error) {
    console.log(error)
  })
</code></pre>

<p>When I do this, I get a 400 response. </p>

<p>I added the <code>'multipart/form-data'</code> header because I filled out the form-data in the Postman request. Without the header I get the same result.</p>

<p>I'm expecting to get the same response I'm getting from Postman, is there something wrong with my config variable in the Node.js script? </p>

<p>Any help would be appreciated!</p>
