So I’m using the below code to firstly get an access token…
$clientID="";
$clientSecret="";
$content = “grant_type=client_credentials&client_id=$clientID&client_secret=$clientSecret”;
$token_url=“https://zoom.us/oauth/token”;
$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
$objJSON = json_decode($result,false);
Which works fine and I get a token back…
$webinarID = “164712960”;
$token_url=“https://api.zoom.us/v2/webinars/”. $webinarID . “/registrants”;
$content ="";
$headers = array(
‘authorization’ => 'Bearer ’ . $objJSON->access_token,
‘content-type’ => ‘application/json’
);
$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
However with the above that I am using to register a new attendee (aware I am not passing any content yet) I am getting a {“code”:124,“message”:“Invalid access token.”} response back.
What am I doing wrong?