title: AADSTS90014: The request body must contain the following parameter: 'grant_type'
body: <p>I am trying to send a post request to receive my access token from <code>https://login.microsoftonline.com/common/oauth2/v2.0/token</code>. When I tried this in my REST client, it works, but when I try to integrate it to my app, it sends me a error <code>400 Bad Gateway</code>, with the message <code>AADSTS90014: The request body must contain the following parameter: 'grant_type'</code>. I tried searching for answers, and found out that I need to implement headers in my post request, so I did that, but it still won't work. Any ideas?</p>
  
  <p>Http Imports:
  <code>import { HttpClient, HttpHeaders, HttpRequest } from '@angular/common/http';</code></p>
  
  <p>Call to post request:</p>
  
  <pre><code>var url=this.outlook_authentification_endpoint+"token";
  var query_parameters=JSON.stringify({grant_type:"authorization_code", client_id:this.outlook_client_id, code: this.outlook_user_code, client_secret: this.outlook_secret_key, redirect_uri: this.outlook_redirect_uri});
  const httpOptions = {
    headers: new HttpHeaders({
      'Content-Type':  'application/x-www-form-urlencoded'
    })
  };
  this.query_service.postOutlook(url, query_parameters, httpOptions, (data)=&gt;
  {   
    console.log(data);
  });
  </code></pre>
  
  <p>Call to the post function:</p>
  
  <pre><code>public postOutlook(url, query, headers, callback)
    {
      this.operation_pending=true;
      this.http_client.post(url,query, headers).subscribe((data)=&gt;
      {
        this.operation_pending=false;
        callback(data);
      });
    }
  </code></pre>
  
  <p>Can anyone see where my error is?</p>