title: Cannot make a POST request with x-www-form-urlencoded c# to Satisfy OAuth
body: <p>I'm attempting to work through set 4 of the Google OAuth API: <a href="https://developers.google.com/youtube/v3/live/guides/auth/server-side-web-apps" rel="nofollow noreferrer">https://developers.google.com/youtube/v3/live/guides/auth/server-side-web-apps</a>.</p>
  <p>I suspect I'm doing something wrong with the &quot;x-www-form-urlencoded&quot; part of this code. The error I'm getting is not very descriptive though, and after trying to work through this I am hitting a wall here. Any thoughts on where I might be going wrong here would be amazing</p>
  <p>I'm getting this error:</p>
  <pre><code>{
    &quot;error&quot;: &quot;invalid_request&quot;,
    &quot;error_description&quot;: &quot;\nYou can\u0026#39;t sign in to this app because it doesn\u0026#39;t comply with Google\u0026#39;s OAuth 2.0 policy for keeping apps secure.\n\nYou can let the app develope
  r know that this app doesn\u0026#39;t comply with one or more Google validation rules.\n  &quot;
  }
  </code></pre>
  <p>With this code:</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Net.Http;
  using System.Net.Http.Headers;
  
  namespace ConsoleApp1
  {
      class Program
      {
          private static readonly HttpClient client = new HttpClient();
          
          static void Main(string[] args)
          {
              var endpoint = new Uri(&quot;https://accounts.google.com/o/oauth2/token&quot;);
  
              var payload = new FormUrlEncodedContent(new[]
              {
                  new KeyValuePair&lt;string, string&gt;(&quot;code&quot;, &quot;4/...&quot;),
                  new KeyValuePair&lt;string, string&gt;(&quot;client_id&quot;, &quot;...&quot;),
                  new KeyValuePair&lt;string, string&gt;(&quot;client_secret&quot;, &quot;...&quot;),
                  new KeyValuePair&lt;string, string&gt;(&quot;redirect_uri&quot;, &quot;http%3A%2F%2Flocalhost%2Foauth2callback&amp;&quot;),
                  new KeyValuePair&lt;string, string&gt;(&quot;grant_type&quot;, &quot;authorization_code&quot;),
              });
              
              payload.Headers.ContentType = new MediaTypeHeaderValue(&quot;application/x-www-form-urlencoded&quot;);
  
              var result = client.PostAsync(endpoint, payload).Result.Content.ReadAsStringAsync().Result;
              
              Console.WriteLine(result);
          }
      }
  }
  </code></pre>