PHP Invalid signature

Hi,
i used next php code to generate the signature

public static function generate_signature($api_key, $api_secret, $meeting_number, $role)
    {
        //Set the timezone to UTC
        date_default_timezone_set(config('app.timezone'));
        $time = time() * 1000 - 30000; //time in milliseconds (or close enough)
        $data = base64_encode($api_key . $meeting_number . $time . $role);
        $hash = hash_hmac('sha256', $data, $api_secret, true);
        $_sig = $api_key . "." . $meeting_number . "." . $time . "." . $role . "." . base64_encode($hash);
        //return signature, url safe base64 encoded
        return rtrim(strtr(base64_encode($_sig), '+/', '-_'), '=');
    }

but i received the next error

{type: ‘JOIN_MEETING_FAILED’, reason: ‘Signature is invalid.’, errorCode: 3712}

the api_key and api_secret i get it from JWT credentials
the metting number it is the id from the response of (https://api.zoom.us/v2/users/" . $zoomUserId . "/meetings)

Hi, @tabe3.app.project,

Welcome to the Developer Forum and thank you for posting. Are you able to share if you are the SDK API key and API secret?

Generate Signature