How do I generate a valid SDK signature from PHP?

Hi, I’m trying to generate a signature but I’m only getting an error.

function generate_signature ( $api_key, $api_secret, $meeting_number, $role){
    //Set the timezone to UTC
      $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), '+/', '-_'), '=');
{type: 'JOIN_MEETING_FAILED', reason: 'Signature is invalid.', errorCode: 3712}

I’m using the CDN

<!-- For ZOOM Component and Client View -->
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <!-- For ZOOM Component View -->
    <script src=""></script>
let meetingSDKElement = document.getElementById('meetingSDKElement')

    debug: true,
    zoomAppRoot: meetingSDKElement,
    language: 'en-US',
    customize: {
        meetingInfo: [
        toolbar: {
            buttons: [{
                text: 'Custom Button',
                className: 'CustomButton',
                onClick: () => {
                    console.log('custom button')

    sdkKey: SDKKEY,
    signature: SIGNATURE,
    meetingNumber: MEETINGNUMBER,
    password: ZOOMPASSWORD,
    userName: ZOOMUSER,

Did you find the solution? Stuck at a similar problem.

Hi, @SVIF,

Welcome to the Zoom Developer Forum – we are thrilled to have you join the community. Would you be able to share what App type you are using to generate the meeting signature? The first thing I would recommend is to manually generate and enter the signature. This will help isolate the root cause of the behavior you are seeing.