title: Google OAuth2 returns "unsupported_grant_type" via cURL (PHP)
body: <p>I want to get data about google account. I use next code:</p>
  
  <pre><code>$curl = curl_init();
  
  curl_setopt_array($curl, array(
      CURLOPT_URL =&gt; 'https://www.googleapis.com/oauth2/v4/token',
      CURLOPT_CUSTOMREQUEST =&gt; "POST",
      CURLOPT_RETURNTRANSFER =&gt; true,
      CURLOPT_TIMEOUT =&gt; 30,
      CURLOPT_HTTPHEADER =&gt; [
          'Cache-Control: no-cache',
          'Content-Type: application/x-www-form-urlencoded',
      ],
      CURLOPT_POSTFIELDS =&gt; [
          'code' =&gt; $code,
          'client_id' =&gt; '{MY_CLIENT_ID}',
          'client_secret' =&gt; '{MY_CLIENT_SECRET}',
          'redirect_uri' =&gt; '{SOME_URL}'
          'grant_type' =&gt; 'authorization_code',
      ]
  ));
  
  $result = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  </code></pre>
  
  <p>In result I get next error:</p>
  
  <pre><code>{
      "error": "unsupported_grant_type",
      "error_description": "Invalid grant_type: "
  }
  </code></pre>
  
  <p>I use instructions from this:</p>
  
  <p><a href="https://developers.google.com/identity/protocols/OpenIDConnect" rel="nofollow noreferrer">https://developers.google.com/identity/protocols/OpenIDConnect</a></p>
  
  <p>Variable <code>$code</code> and another data are valid! Because I try to send request via "PostMan" and there I get correct result.</p>
  
  <p>Tell me please, where I have mistake?</p>