title: (401) Unauthorized exception while downloading file from SharePoint
body: <p>I have generated an access token using OAuth mechanism for SharePoint Online server. I am using this token to create ClientContext using CSOM. While I am able to access all the sites, libraries, and folders seamlessly, I get error    </p>
  
  <blockquote>
    <p>The remote server returned an error: (401) Unauthorized.</p>
  </blockquote>
  
  <p>while downloading the file from SharePoint Online. Below is the code that I am using for file download:</p>
  
  <pre><code>var clientContext = TokenHelper.GetClientContextWithAccessToken("https://adventurer.sharepoint.com/Subsite1", accessToken);
  var list = clientContext.Web.Lists.GetByTitle("SubSite 1 Library 1");
  string vquery = @"&lt;View Scope='RecursiveAll'&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name='UniqueId' /&gt;&lt;Value Type='Lookup'&gt;" + "6718053d-a785-489c-877f-5a4b88dcb2a7" + "&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;";
  CamlQuery query = new CamlQuery();
  query.ViewXml = vquery;
  var listItems = list.GetItems(query);
  clientContext.Load(listItems, items =&gt; items.Take(1).Include(item =&gt; item.File));
  clientContext.ExecuteQuery();
  
  var fileRef = listItems[0].File.ServerRelativeUrl;
  var fileInfo = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, fileRef);
  </code></pre>
  
  <p>I don't understand the root cause of this error, as I am passing client context with right access token. I want to know if OpenBinaryDirect has a limitation to work with access tokens? If not, what is wrong with above code? Is there any other alternative that can be used to download using access token?</p>