I can not provide AccountID Access Can you help?

Hello everyone, I create my token with Client ID and Client Secret and get this token.

        $client = new Client();

        $response = $client->post('https://zoom.us/oauth/token', [
            'form_params' => [
                'grant_type' => 'client_credentials',
                'client_id' => $this->clientId,
                'client_secret' =>$this->clientSecret,

        $accessToken = json_decode($response->getBody()->getContents())->access_token;
        $response = $client->get('https://api.zoom.us/v2/users/me', [
            'headers' => [
                'Authorization' => 'Bearer'. $accessToken,
                'Content-Type' => 'application/x-www-form-urlencoded',

but when I try to get account_id with the access_token I created, I get an invalid token error.

“Client error: GET https://api.zoom.us/v2/users/me resulted in a 401 Unauthorized response:\n{"code":124,"message":"Invalid access token."}\n”

@mehmet3387 ,

Could you share if you are doing Oauth or Server to Server Oauth?

I am using oAuth and I am trying to switch from jwt token to oAuth.


I’m doing something like this.
For OAuth, the user typically clicks on a URL to install the app, and Zoom will redirect the token to your own hosted service. The below code is for my own hosted service on php.asdc.cc/redirecturlforoauth.php


$config = include 'config.php';
$oauthClientId = $config['oauth_client_id'];
$oauthClientSecret = $config['oauth_client_secret'];

$code =$_GET['code'];

    //echo "handleRedirectUrlDataRequest\n";
    $url = "https://zoom.us/oauth/token";
    $redirectUri = "https://php.asdc.cc/$path";
    //echo "$redirectUri\n";
    // Encode the client ID and client secret
    $credentials = "$oauthClientId:$oauthClientSecret";
    //echo "$credentials\n";
    $credentialsEncoded = base64_encode($credentials);

    $headers = [
        "Authorization: Basic $credentialsEncoded",
        "Content-Type: application/x-www-form-urlencoded"
    //echo "$credentialsEncoded\n";

    $data = [
        'grant_type' => 'authorization_code',
        'redirect_uri' => $redirectUri,
        'code' => $code
     //echo "$data\n";
    // Encode the data dictionary as x-www-form-urlencoded
    $dataEncoded = http_build_query($data);
    //echo "$dataEncoded\n";
    $options = [
        'http' => [
            'header' => implode("\r\n", $headers),
            'method' => 'POST',
            'content' => $dataEncoded
    $context = stream_context_create($options);
    $response = file_get_contents($url, false, $context);
    $httpStatus = $http_response_header[0]; // Get the HTTP status from the headers

    if (strpos($httpStatus, '200 OK') !== false) {
        //echo "response 200\n";
        $responseJson = json_decode($response, true); // Decode JSON as associative array
        // Optionally, you can return an HTTP status code
        http_response_code(200); // Replace 200 with your desired status code
        // Set the "Content-Type" header to "application/json"
        header('Content-Type: application/json');

        // Encode the JSON data and return it
        echo json_encode($responseJson);

    } else {
        // Handle the case where the response has an error status code
        echo "$httpStatus\n";


I get the token, but I need zoom_id, it doesn’t give me a return, in fact, the answers it gives are very absurd and strange.

@mehmet3387 could you elaborate on what “zoom_id” you are referring to?