title: How to get the list item using REST API in c#
body: <p>I want to retrieve all the list of SharePoint online using REST API in c#. 
  For this, i am using below code</p>
  
  <pre><code>HttpWebRequest endpointRequest = (HttpWebRequest)HttpWebRequest.Create("https://o365.sharepoint.com/sites/test-site/_api/web/lists");
  endpointRequest.Method = "GET";
  endpointRequest.Accept = "application/json;odata=verbose";
  endpointRequest.ContentLength = 0;
  </code></pre>
  
  <p>But i am getting below error </p>
  
  <p>403:Forbidden Access denied. Before opening files in this location. you must first browse to the web site and select the option to login automatically.</p>
  
  <p>So i have searched on this and found that we have to pass AuthenticationToken, which is written in this link</p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/jj164022.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/jj164022.aspx</a></p>
  
  <pre><code>endpointRequest.Headers.Add("Authorization", "Bearer " + accessToken);
  </code></pre>
  
  <p>But how do i get the accesstoken ?</p>