title: Microsoft Graph API, DELETE request response Error code 403 ""Access is denied. Check credentials and try again."
body: <p>I am working on a Microsoft Graph API app where i want to delete email messages from the inbox.
  I do that by first getting the emails, putting the id from each email in an array and for each id in that array making a delete request to remove it from the inbox.</p>
  
  <p>When I try and run my code i get the error</p>
  
  <pre><code>Error: Server responded to *request link* with status code 403:
  {
    "error": {
      "code": "ErrorAccessDenied",
      "message": "Access is denied. Check credentials and try again.",
      "innerError": {
        "request-id": "*request id*",
        "date": "2020-06-03T09:12:06"
      }
    }
  }
  </code></pre>
  
  <p>When making the delete request I pass in the same Access Token that i use to make the get request for getting the email data.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>// This is only the code for the delete request, passing the Access Token works aswell as passing the IDList array. It loops trough all the id's and tries to make a request. But the request fails
  removeEmail(IDList, AccessToken);
  
  function removeEmail(idList, accessToken) {
      idList.forEach(ID =&gt; {
          var deleteEmails = request('DELETE', `https://graph.microsoft.com/v1.0/me/messages/${ID}`, {
              headers: {
                  'Authorization': `Bearer ${accessToken}`
              }
          });
  
          deletedEmails = JSON.parse(deleteEmails.getBody('utf8'));
  
          console.log(deleteEmails);
      });
  }
  
  </code></pre>
  
  <p>How can this be fixed so that it removes the messages from the inbox without any problems?</p>
  
  <p>Thanks in advance!</p>