include "vendor/autoload.php";
use \Firebase\JWT\JWT;
$key = "*********";
$payload = array(
"iss" => "******",
"exp" => time()+36000,
);
$jwt = JWT::encode($payload, $key, 'HS256');
$curl = curl_init();
$d = "https://us02web.zoom.us/rec/download/ABCDEFGH?access_token=".$jwt;
curl_setopt_array($curl, array(
CURLOPT_URL => $d,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTPHEADER => array(
"authorization: Bearer {$jwt}",
"content-type: application/json"
), ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
This script works well with zoom api. I can read anything I need. But when I try to download file by download_link, using JWT token (as in script). I get
{"status":false,"errorCode":401,"errorMessage":"Forbidden"}
message
What I do wrong? Thank you.