Having trouble making basic REST API calls via PHP Oauth

Description
I have successfully made a connection using the Oauth app I’ve set up via PHP, but I cannot find any examples for making a simple REST API call and seem to be having trouble even making a simple call to get a list of users.

Error
My function returns the following: “code”:200,“message”:"Invalid api key or secret.

Which App Type (OAuth / Chatbot / JWT / Webhook)?
OAuth

Which Endpoint/s?
https://api.zoom.us/v2/users

Here is the code:
function getAccessToken() {
$clientID=“jLQXLFYPTyWUMyGzF3O7hA”;
$clientSecret=“0mKFLUXLqKNYzVBxWyCmXuuPDOih94ug”;
$content = “grant_type=client_credentials&client_id=$clientID&client_secret=$clientSecret”;
$token_url=“https://zoom.us/oauth/token”;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $token_url,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $content
));
$response = curl_exec($curl);
curl_close($curl);

	if ($response === false) {
    $retVal["Status"]=0;
		$retVal="Failed to retrieve code";
	} elseif (json_decode($response)->error) {
		$retVal["Status"]=0;
    $retVal["Message"]="Error: $response";
	} else {
    $retVal["Status"]=1;
    $retVal["Token"]=json_decode($response)->access_token;
}

	return $retVal;
}

$token = getAccessToken();
print "<pre>\n";
var_dump($token);
print "</pre>\n";



// get users
function getUsers() {
    $auth=getAccessToken();
    if (!$auth["Status"]) {
        $retVal["Status"]=9;
        $retVal["Message"]=$auth["Message"];
    } else {
        $url="https://api.zoom.us/v2/users";
        $token=$auth["Token"];
        $header = array("Authorization: Bearer $token","Content-Type: application/json");
        $curl = curl_init();
	    curl_setopt_array($curl, array(
		    CURLOPT_URL => $url,
		    CURLOPT_HTTPHEADER => $header,
		    CURLOPT_SSL_VERIFYPEER => true,
		    CURLOPT_RETURNTRANSFER => true,
		    CURLOPT_POST => true,
		    CURLOPT_POSTFIELDS => json_encode($msg)
	    ));
        $response = curl_exec($curl);

        if ($response === false) {
            $retVal["Status"]=8;
		    $retVal["Message"]=curl_error($curl);
	    } elseif (json_decode($response)->error) {
		    $retVal["Status"]=7;
            $retVal["Message"]="Error: $response";
	    } else {
            $retVal["Status"]=1;
            $retVal["Message"]=$response;
        }
        curl_close($curl);
    }
    return $retVal;
}
$users = getUsers();
print "<pre>\n";
var_dump($users);
print "</pre>\n";

Hey @rrs207,

Looks like you are getting a Chatbot token instead of an OAuth access token.

To call the Zoom APIs other than the Zoom Chatbot APIs, you need to use the authorization_code grant type during OAuth.

Thanks,
Tommy