string(50) "{"code":124,"message":"Access token is required."}" - PHP


#1

When I call the meeting API for create new meeting it will show the following error

string(50) “{“code”:124,“message”:“Access token is required.”}”

 

<?php

$header = array(
    ‘Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50SWQiOiJCWGNNRmRfTFRuZU1oZEpiRnhDcVlBIiwiY2xpZW50SWQiOiJMZE05a3dOQVE3YXc1b1N3Uk1Qc2ZBIiwic2NvcGVzIjpbeyJuYW1lIjoibWVldGluZzp3cml0ZSIsInBhcmFtcyI6W119LHsibmFtZSI6InVzZXI6cmVhZCIsInBhcmFtcyI6W119LHsibmFtZSI6InJlY29yZGluZzp3cml0ZSIsInBhcmFtcyI6W119LHsibmFtZSI6IndlYmluYXI6d3JpdGUiLCJwYXJhbXMiOltdfV0sInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsImV4cCI6MTUyODc5ODk3NywidXNlcklkIjoiQlZBNXlkbWtTbENOVC1STWNCakdQZyIsImlhdCI6MTUyODc5NTM3NywianRpIjoiOWFmZWI3NTQtZGQ0ZS00NTBlLTkzZWMtMThjNmI3ZDhjMDJkIn0.aY4DYi6FPb8pbuoIPVx44pRVsDSvr9usTPluBzD1xbI’
);
$post = [
    ‘topic’      => ‘Zoom example meeting 1’,
    ‘type’       => ‘2’,
    ‘start_time’ => ‘2018-02-10T08:00:45+00:00’,
];

$ch = curl_init(‘https://api.zoom.us/v2/users/me/meetings’);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

// execute!
$response = curl_exec($ch);

// close the connection, release resources used
curl_close($ch);

// do anything you want with your response
var_dump($response);

?>


#2

Hi Arghya, 

Have you tried calling the same API and token using POSTman or any other API development tool? If it works with Postman, it may be an issue with your code. 

Thanks

Michael