Hello while am working to integrate the new server-to-server app because the JWT is not working anymore i am having a response when am calling the API error code : 200 error code - Account does not enable rest API, I am getting the access token successfully, call the API when we get the user, by that time I am facing this issue, could you please advise if I am missing any parameter
i have set all key and accound correctly
public function getToken(){
$url = ‘https://zoom.us/oauth/token’;
$api_key = ‘’;
$api_secret = ‘’;
$data = array(
'grant_type' => 'client_credentials',
'account_id'=>''
);
$headers = array(
'Authorization: Basic ' . base64_encode($api_key . ':' . $api_secret),
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
$token_data = json_decode($response, true);
$token =$token_data['access_token'];
return $token;
//print_r($token_data);
/* $payload = array();
$secret = 'redacted';
$payload['iss'] = 'AP7n1CtHRA67f2Vvn2ZApQ';
$payload['exp'] = strtotime('+1 minute');
return $token = \Firebase\JWT\JWT::encode($payload, $secret, 'HS256'); */
}
function getUser($user){
$token = $this->getToken();
$body = array();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.zoom.us/v2/users/".$user['email'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode($body),
CURLOPT_HTTPHEADER => array("Authorization: Bearer $token"),
));
$response = curl_exec($curl);
//Check for any errors
$errorMessage = curl_exec($curl);
//echo $errorMessage;
curl_close($curl);
if(!$response){
return false;
}
$arrdata= json_decode($response, true);
return $arrdata;
}