Trying to get a list of cashbooks from API, but always comes back with ( "Message":"Authorization has been denied for this request."). I'm positive the subscription key is right, I can get the access and refresh tokens, and the user I login to the identity server with has access to multiple cashbooks. And if I login to the azure developer portal and use the "Try Me" test for "Get Cashbooks" it works. Can anyone help?
This is my code:
$subscription_key = '<<SUBSCRIPTION-KEY>>';
$url = 'https://api.reckon.com/R1/cashbooks?subscription-key=' . $subscription_key;
$header = array();
$header[] = 'Content-length: 0';
$header[] = 'Content-type: application/json';
$header[] = 'Authorization: Bearer' . $access_token;
$header[] = 'Ocp-Apim-Subscription-Key' . $subscription_key;
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 2);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);
curl_close($curl);
echo $response;