title: How to post a subrequest with a json body to another server from NGINX http request object
body: <p>Interface with Auth0 requiring a post request with a json body to retrieve the token and set it in the Header Authorization Bearer. I have trouble to set the json body in the subrequest in the nginx js mdoule for the token. Please advice</p>
  <pre><code>```
  function introspectAccessToken(r) {
      // Prepare Authorization header for the introspection request
      var jsbody = {&quot;grant_type&quot; : &quot;authorization_code&quot;,
                &quot;client_id&quot; : r.variables.oauth_client_id,
                &quot;client_secret&quot; : r.variables.oauth_client_secret,
                &quot;code&quot; : r.args_code,
                &quot;redirect_uri&quot;:&quot;http://office.etag-hk.com/login&quot;};
      var jsString = JSON.stringify(jsbody);
      r.RequestBuffer = jsString;
      // Make the OAuth 2.0 Token Introspection request
      r.error(&quot;OAuth jsbody: &quot; + jsString);
      r.subrequest(&quot;/_oauth2_send_introspection_request&quot;,
          function(reply) {
             if (reply.status != 200) {
                 r.error(&quot;OAuth unexpected response from authorization server (HTTP &quot; + reply.status + 
              &quot;). &quot; + reply.body);
                  r.return(401);
              }
  </code></pre>
  <pre><code>Thanks
  </code></pre>