title: Authentication for Box in C# 4.0
body: <p>I'm trying to get the access token using the below code in C# language, but I'm getting 400 bad request exception.</p>
  
  <p>Code:</p>
  
  <pre><code>WebRequest httpWReq = WebRequest.Create("https://www.box.com/api/oauth2/token");
  
  
  string postData = "grant_type=authorization_code"; 
  postData += "&amp;code=" + Code; 
  postData += "&amp;client_id=MY_CLIENT_ID"; 
  postData += "&amp;client_secret=MY_CLIENT_SECRET"; 
  postData += "&amp;redirect_uri=https://www.google.com";
  
  byte[] data = Encoding.UTF8.GetBytes(postData); 
  httpWReq.Method = "POST"; 
  httpWReq.ContentType = "application/x-www-form-urlencoding"; 
  httpWReq.ContentLength = data.Length; 
  
  using (Stream stream = httpWReq.GetRequestStream()) 
  { 
      stream.Write(data, 0, data.Length); 
  }
  
  var response = httpWReq.GetResponse();
  var responseStream = response.GetResponseStream();
  using (var reader = new StreamReader(responseStream))
  {
      var responseReader = reader.ReadToEnd();
      MessageBox.Show(responseReader);
  }
  </code></pre>
  
  <p>But I'm always getting the following Error:</p>
  
  <pre><code>{"error":"invalid_request","error_description":"Invalid grant_type parameter or parameter missing"}
  </code></pre>
  
  <p>How to overcome this problem?</p>
  
  <p>Any Help will be appreciated. Thanks in Advance.</p>
  
  <p>Thanks,
  Harish Reddy</p>