title: How to set Authorization Bearer for Google API on CURLRequest CI4?
body: <p>I already got access_token and want to access Google API with the following code:</p>
  <pre><code>$client = \Config\Services::curlrequest();
  $userAPI = &quot;https://www.googleapis.com/oauth2/v2/userinfo&quot;;
  $response = $client-&gt;request(&quot;GET&quot;, $userAPI, [
              &quot;version&quot; =&gt; 1.1,
              &quot;http_errors&quot; =&gt; false,
              &quot;header&quot; =&gt; [
                  &quot;Authorization&quot; =&gt; &quot;Bearer &quot; . $body-&gt;access_token],
              &quot;debug&quot; =&gt; true
          ]
      );
  </code></pre>
  <p>but I got 400 bad requests. The log on PHP spark didn't say anything about authorization.</p>
  <pre><code>GET /oauth2/v2/userinfo HTTP/1.1
  Host: www.googleapis.com
  Accept: */*
  Content-Length: 300
  Content-Type: application/x-www-form-urlencoded
  * upload completely sent off: 300 out of 300 bytes
  * old SSL session ID is stale, removing
  * HTTP 1.0, assume close after body
  &lt; HTTP/1.0 400 Bad Request
  &lt; Content-Type: text/html; charset=UTF-8
  &lt; Referrer-Policy: no-referrer
  &lt; Content-Length: 1555
  &lt; Date: Sat, 06 Feb 2021 05:48:10 GMT
  &lt;
  * Closing connection 0
  </code></pre>
  <p>Did I miss something?</p>
  <p>edit:
  Typo on &quot;header&quot;, it must be &quot;headers&quot;. It successfully sends authorization bearer but the status code still 400 bad request.
  New log:</p>
  <pre><code>&gt; GET /oauth2/v2/userinfo HTTP/1.1
  Host: www.googleapis.com
  Accept: */*
  Content-Length: 300
  Content-Type: application/x-www-form-urlencoded
  Authorization: Bearer ya29.a0AfH***********************
  
  * upload completely sent off: 300 out of 300 bytes
  * old SSL session ID is stale, removing
  * HTTP 1.0, assume close after body
  &lt; HTTP/1.0 400 Bad Request
  &lt; Content-Type: text/html; charset=UTF-8
  &lt; Referrer-Policy: no-referrer
  &lt; Content-Length: 1555
  &lt; Date: Sat, 06 Feb 2021 06:49:54 GMT
  &lt;
  * Closing connection 0
  </code></pre>