title: invalid oauth2 token request
body: <p>I'm developing a node application which needs to authenticate with google. When I request a token, <a href="https://accounts.google.com/o/oauth2/token" rel="noreferrer">https://accounts.google.com/o/oauth2/token</a> responds with:</p>
  
  <pre><code>error: 400
  { 
    "error" : "invalid_request"
  }
  </code></pre>
  
  <p>I've tried making the same request in curl, and have received the same error, so I suspect there is something wrong with my request but I can't figure out what. I've pasted my code below:</p>
  
  <pre><code>var request = require('request');
  var token_request='code='+req['query']['code']+
                    '&amp;client_id={client id}'+
                    '&amp;client_secret={client secret}'+
                    '&amp;redirect_uri=http%3A%2F%2Fmassiveboom.com:3000'+
                    '&amp;grant_type=authorization_code';
  request(
      { method: 'POST',
        uri:'https://accounts.google.com/o/oauth2/token',
        body: token_request
      },
      function (error, response, body) {
          if(response.statusCode == 201){
              console.log('document fetched');
              console.log(body);
          } else {
              console.log('error: '+ response.statusCode);
              console.log(body);
          }
      });
  </code></pre>
  
  <p>I've triple checked to make sure all the data I'm submitting is correct and i'm still getting the same error. What can I do to debug this further?</p>