title: OAuth 2.0 In .NET With Instagram API
body: <p>I am working on consuming the Instagram API and I am stuck at step 2 of their OAuth.  I have a code from their redirect back to me, but then they want me to do a post with parameters like below...</p>
  
  <pre><code>curl \
      -F 'client_id=CLIENT-ID' \
      -F 'client_secret=CLIENT-SECRET' \
      -F 'grant_type=authorization_code' \
      -F 'redirect_uri=YOUR-REDIRECT-URI' \
      -F 'code=CODE' \
      https://api.instagram.com/oauth/access_token
  </code></pre>
  
  <p>I am implementing this as an ASP.NET MVC 3 solution.  I tried to implement the post like so...</p>
  
  <p><pre><code>
      WebRequest request = HttpWebRequest.Create("https://api.instagram.com/oauth/access_token");
      request.Method = "POST";
      request.Headers.Add("client_id", "sdlf0982jiejfopijfp92jjiwoijf90");
      request.Headers.Add("client_secret", "39993939393939393939393939393");
      request.Headers.Add("grant_type", "authorization_code");
      request.Headers.Add("redirect_uri", "http://localhost:34962/Home/Auth");
      request.Headers.Add("code", 111111);
      var response = request.GetResponse();
      return View();
  </pre></code></p>
  
  <p>This gives me a 400 error saying that "client_id is required".  I have included the client_id, but I'm clearly not implementing this correctly.</p>
  
  <p>What is the "best practice" way to perform the second leg of the OAuth?</p>