title: Authenticating a REST request in an Excel Add-in
body: <p>I am trying to develop an add-in for Excel with the goal that it will create calendar events based on data inside a spreadsheet.</p>
  
  <p>I can do almost everything that I want except use the REST API to build the events in the calendar and I can't exactly figure out where I went wrong.</p>
  
  <p>I have followed the <a href="https://dev.office.com/docs/add-ins/develop/create-sso-office-add-ins-nodejs" rel="nofollow noreferrer">documentation suggested by @MarcLaFleur</a>.</p>
  
  <p>I can build and run the application no problem, but when I click on the 'Get my files from OneDrive' button, I get the following: </p>
  
  <pre><code>Code: 5001
  Message: An internal error has occurred.
  name: Internal Error
  </code></pre>
  
  <p>This is coming from the program.js file in the public directory somewhere in the else clause of this function.</p>
  
  <pre class="lang-cs prettyprint-override"><code>function getDataWithoutAuthChallenge() {
      Office.context.auth.getAccessTokenAsync({ forceConsent: false },
          function (result) {
              if (result.status === "succeeded") {
                  // TODO1: Use the access token to get Microsoft Graph data.
                  accessToken = result.value;
                  getData("/api/onedriveitems", accessToken);
              }
              else {
                  console.log("Code: " + result.error.code);
                  console.log("Message: " + result.error.message);
                  console.log("name: " + result.error.name);
                  document.getElementById("getGraphAccessTokenButton").disabled = true;
              }
          });
  }
  </code></pre>
  
  <p>Here are the scopes in my <code>manifest.xml</code></p>
  
  <pre class="lang-xml prettyprint-override"><code>    ...
      &lt;WebApplicationInfo&gt;
        &lt;Id&gt;c931b396-7 ... &lt;/Id&gt;
        &lt;Resource&gt;api://localhost:3000/c931b396-7 ... &lt;/Resource&gt;
        &lt;Scopes&gt;
          &lt;Scope&gt;files.read.all&lt;/Scope&gt;
          &lt;Scope&gt;profile&lt;/Scope&gt;
        &lt;/Scopes&gt;
      &lt;/WebApplicationInfo&gt;
    &lt;/VersionOverrides&gt;
  </code></pre>
  
  <p>And here are the scopes on <code>apps.dev.microsoft.com</code>:</p>
  
  <p><a href="https://i.imgur.com/zz1WeuK.jpg" rel="nofollow noreferrer"><img src="https://i.imgur.com/zz1WeuK.jpg" alt="Imgur"></a></p>
  
  <p>If you can shed any light for me, it would really help me out.</p>