title: Get invalid_grant error when attempting to refresh a token
body: <p>I am developing a node.js application which uses outlook rest API to fetch the mails. I am using <a href="https://docs.microsoft.com/en-gb/graph/auth-v2-user" rel="nofollow noreferrer">this</a> API.</p>
  
  <p>I am trying to refresh the token using the following request. I am using request npm to call the API</p>
  
  <pre><code>{
      url: 'https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token',
      method: 'POST',
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
      formData:
      {
          scope: 'offline_access User.Read Mail.Read',
          client_id: 'c251b61b-c6db-4f64-89bd-7009444d1bc8',
          grant_type: 'refresh_token',
          redirect_uri: 'http://localhost:3000/myurl',
          refresh_token: 'refresh-token',
          client_secret: 'cli-secret'
       }
  }
  </code></pre>
  
  <p>but getting the following error </p>
  
  <pre><code>{
    "error": "invalid_grant",
    "error_description": "AADSTS9002313: Invalid request. Request is malformed or  invalid.745ec0500",
    "correlation_id": "a2d87f11-0671-41f1-a5e7-654f1796c3d1"
  }
  </code></pre>
  
  <p>I have also tried with adding <code>Content-length</code> in headers and appending all variables into a string using <code>&amp;</code> and <code>=</code> and sending that in the body, but I got the same error. I am getting an <code>access-token</code> successfully.</p>