title: Correct way to set Bearer token with cURL
body: <p>I get my bearer token from an API end point and set the following:</p>
  <pre class="lang-php prettyprint-override"><code>$authorization = &quot;Bearer 080042cad6356ad5dc0a720c18b53b8e53d4c274&quot;
  </code></pre>
  <p>Next, I want to use cURL to access the secure endpoint however I am unsure on how or where to set the Bearer token.</p>
  <p>I have tried this but it does not work:</p>
  <pre class="lang-php prettyprint-override"><code>curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, &quot;POST&quot;);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  $result = curl_exec($ch);
  curl_close($ch);
  return json_decode($result);
  </code></pre>
  <p><a href="https://apigility.org/documentation/auth/authentication-oauth2" rel="nofollow noreferrer">According to the documentation</a>, I am supposed to be using the bearer token as such:</p>
  <pre class="lang-none prettyprint-override"><code>GET /oauth/resource HTTP/1.1
  Accept: application/json
  Authorization: Bearer 907c762e069589c2cd2a229cdae7b8778caa9f07
  </code></pre>