I get my bearer token from an API end point and set the following:
$authorization = "Bearer 080042cad6356ad5dc0a720c18b53b8e53d4c274"
Next, I want to use cURL to access the secure endpoint however I am unsure on how or where to set the Bearer token.
I have tried this but it does not work:
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
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);
According to the documentation, I am supposed to be using the bearer token as such:
GET /oauth/resource HTTP/1.1
Accept: application/json
Authorization: Bearer 907c762e069589c2cd2a229cdae7b8778caa9f07