title: How to get access token? (Reddit API)
body: <p>I wonder if it is possible to get a permanent access token for personal use on Reddit?
  It will only be me using the App.</p>
  
  <p>For users, the access token expires after 1 hour.</p>
  
  <p>My using the below information that I have about my client-id and secret, I put up a start attempt of trying to get an access token. (MessageBox show "<strong>Error 401</strong>")</p>
  
  <p>If a user will get a token, one have to click "Allow" in the browser. Very well described here. <a href="https://github.com/reddit/reddit/wiki/OAuth2" rel="noreferrer">https://github.com/reddit/reddit/wiki/OAuth2</a>
  This it NOT what I am after. I am after for, personal use, an access token only through code. Is this possible?</p>
  
  <pre><code>            String requestUrl = "https://ssl.reddit.com/api/v1/access_token";
  
          RestSharp.RestClient rc = new RestSharp.RestClient();
          RestSharp.RestRequest request = new RestSharp.RestRequest(requestUrl, RestSharp.Method.POST);
          request.AddHeader("Content-Type", "application/json");
          //request.AddHeader("Authorization", ""); //???
          request.AddHeader("x-li-format", "json");
  
          request.AddParameter("client_id", "abcdefg");
          request.AddParameter("client_secret", "abc123-456");
          request.AddParameter("grant_type", "abc123-456");
          request.AddParameter("scope", "identity");
          request.AddParameter("state", "adhasegw"); //whatever value
          request.AddParameter("duration", "permanent");
          request.AddParameter("redirect_uri", "http://mywebsite.co");
  
          request.RequestFormat = RestSharp.DataFormat.Json;
  
          RestSharp.RestResponse restResponse = (RestSharp.RestResponse)rc.Execute(request);
          RestSharp.ResponseStatus responseStatus = restResponse.ResponseStatus;
  
  
  
          MessageBox.Show(restResponse.Content.ToString() + "," + responseStatus.ToString());
  </code></pre>