title: Handle JSON response from POST-request
body: <p>Im having trouble with reading JSON-response when sending a POST request to a oauth server. This is my code for POST:</p>
  
  <pre><code>var request = require("request");
  var querystring = require('querystring');
  
  var postData={
      grant_type: 'code',
      code: code,
      redirect_uri: uri,
      nonce: nonce
  };
  
  request.post({
      uri: oauth_token_uri    ,
      headers:
      {
          'Content-Type': 'application/x-www-form-urlencoded',
          'Authorization': oauth_code
      },
      body: querystring.stringify(postData)
  }, function(err,res, body){
      console.log("BODY:" + res.body);
      console.log("BODY: " + body);
      console.log("Access Token:" + res.body.access_token);
      console.log("Access Token:" + body.access_token);
  });
  </code></pre>
  
  <p>This is the output in the console:</p>
  
  <pre><code>BODY:{"access_token":"somecode","refresh_token":"somecode","expires_in":900,"token_type":"bearer","id_token":"someTokenID"}
  BODY:{"access_token":"somecode","refresh_token":"somecode","expires_in":900,"token_type":"bearer","id_token":"someTokenID"}
  Access Token:undefined
  Access Token: undefined
  </code></pre>
  
  <p>What am I doing wrong here?</p>