Invalid API - to implement a webform

I am trying to implement a webform to add participants to a meeting.
So, I am first trying to obtain an authorization token by calling https://zoom.us/oauth/token. Then I try to add participants: https://api.zoom.us/v2/meetings/{$meetingId}/registrants
… but I get {“code”:200,“message”:“Invalid api key or secret.”}.

$clientID       = "*********************";
$clientSecret   = "*********************";
$meetingId      = "*********************";

$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);
$oauth_access_token = $objJSON->access_token;




 
$token_url = "https://api.zoom.us/v2/meetings/{$meetingId}/registrants";
$content   = "{\"email\":\"myemail@mycompany.com\",\"first_name\":\"Mike\",\"last_name\":\"rown\",\"phone\":\"111-444-4444\"}";
$headers   = array(
  "Authorization" => "Bearer " . $oauth_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);

var_dump( json_decode($result,true) );

Hi @pucpsalavirtual418,

Please make sure you’re setting your grant_type parameter in your OAuth request to authorization_code, not client_credentials:

client_credentials is only for our Chatbot apps.

Let me know if this resolves the issue—thanks!
Will