Failed to join meeting when using websdk

I have created a meeting using api and jwt app API key and secret key. Then I installed @zoomus/websdk the n when I click the join meeting in web a signature is generated in backend with PHP and then join the meeting but it says type: ‘JOIN_MEETING_FAILED’, reason: ‘Fail to join the meeting.’, errorCode: 200

code to generate signature in backend:

public function generate_signature($meeting_number, $role)
    {
        $api_key = config('zoom.zoom_sdk_key');
        $api_secret = config('zoom.zoom_sdk_secret');
        $now = Carbon::now();

        //build the headers
        $headers = ['alg' => 'HS256', 'typ' => 'JWT'];
        $headers_encoded = $this->base64url_encode(json_encode($headers));
        $exp = $now->addSeconds(1800)->timestamp;
        //build the payload
        $payload = [
            'sdk_key' => $api_key,
            'mn' => $meeting_number,
            'role' => $role,
            'iat' => $now->timestamp,
            'exp' => $exp,
            'app_key' => $api_key,
            'tokenExp' => $exp
        ];
        $payload_encoded = $this->base64url_encode(json_encode($payload));

        //build the signature
        $signature = hash_hmac('SHA256', "$headers_encoded.$payload_encoded", $api_secret, true);
        $signature_encoded = $this->base64url_encode($signature);

        $token = "$headers_encoded.$payload_encoded.$signature_encoded";

        // Log::debug($token);
        return $token;
    }

    private function base64url_encode($data)
    {
        return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
    }

In web to join the code is:

async getSignature() {
        await axios.post(this.signatureEndpoint, {
            meeting_number: this.$props.meetingNumber,           
            role: this.$props.role
        })
        .then(res => {
            console.log(res.data.signature);
            this.startMeeting(res.data.signature);
        })
        .catch(error => {
            console.log(error);
        });
        },
        startMeeting(signature) {
        let meetingSDKElement = document.getElementById('meetingSDKElement');
        this.client.init({
            debug: true,
            zoomAppRoot: meetingSDKElement,
            language: 'en-US',
            customize: {
            meetingInfo: ['topic', 'host', 'mn', 'pwd', 'telPwd', 'invite', 'participant', 'dc', 'enctype'],
            toolbar: {
                buttons: [
                {
                    text: 'Custom Button',
                    className: 'CustomButton',
                    onClick: () => {
                    console.log('custom button');
                    }
                }
                ]
            }
            }
        });
        this.client.join({
            sdkKey:  Meeting-SDK-KEY
            signature: signature,
            meetingNumber: this.$props.meetingNumber,           
            password: this.$props.passWord,
            userName: this.$props.userName,
            //userEmail: this.$props.userEmail,            
            // tk: this.registrantToken
        })
        }

Anyone, Can you please help me out with this above error? What am I doing wrong if I know then I can solve it. Please, someone, help

@iamtherealdp ,

Welcome to the Zoom Developer Forum. To clarify, are you using credentials from the Marketplace JWT app type or the Meeting SDK App type? For the Web SDK, you should be using the credentials from the Meeting SDK app type. Here is our documentation on this :

Hi ,
I am using the Meeting SDK credentials.
What I am doing:

  1. Creating a meeting from zoom dashboard

  2. Then copy the Meeting SDK key and secret

  3. Then creating the signature from backend PHP with meeting number and role and meeting SDK secret

  4. Then with websdk trying to join to that meeting

Now what I am doing wrong. The code for joining is below

 this.client.join({
            sdkKey: 'XXXXX,
            signature: signature,
            meetingNumber: this.$props.meetingNumber,           
            password: this.$props.password,
            userName: this.$props.userName,
            userEmail: this.$props.userEmail,
                  
            // tk: this.registrantToken
        })

And one more thing I am testing it in localhost and the Meeting SDK app is in draft mode

The signature I generated in backend

@iamtherealdp ,

Thanks for the details! The configuration for the signature and Zoom init and Join functions looks good. Perhaps not all of the values are being passed in as expected. I’ve encountered that same error before, and the issue was that the value for the role was not being passed to the backend where the signature was being generated. To further debug, the first thing I’d recommend is trying to isolate whether the problem is how the signature is generated or how the meeting is being Joined. Here is a path you can consider to do so:

To rule out the signature:

  1. Manually enter the value for the signature that is generated in the backend with PHP in the Zoom Join function. This will help determine if the signature is the problem.

  2. Alternatively, use our sample App to generate the signature and either make a request to the endpoint or manually entered the value.

If the issue still persists, then it’s likely there may be a problem with one or more of the values being passed into the join function. To debug:

  1. Manually enter all the values for the Join function (sdkKey, signature, meetingNumber, password, userName, userEmail). This should further diagnose what may be happening.

  2. Alternatively, use our sample Meeting SDK App to test and compare the join flow against your implementation.

Please share the results of your finding as we are always happy to help!

Hi,
I tried with the above approches but the same result


I tried by creating signature with the node.js app you gave but the error given was “Signature Invalid”

@iamtherealdp ,

What is the error that is displayed in the console?

Also, are you seeing the same result when testings with Sample React Meeting SDK?

Same no console error only “Failed to join the meeting”

@iamtherealdp , It seems something may be off with your implementation, I’d suggest testing with our Sample App and using it as a reference for your implementation.

Also, I sent you a private message, please check.

you signature looks strange

token

iat == exp == tokenExp

iat and exp should be different (2 hours)

  const iat = Math.round((new Date().getTime() - 30000) / 1000)
  const exp = iat + 60 * 60 * 2
   ...
    tokenExp: iat + 60 * 60 * 2
  }

Hello I changed the exp time is added 2hrs from iat time. Then also I am getting the same issue “Failed to join the meeting”

is your Meeting SDK App Live?

No it is in draft mode

Some how I managed to correct myself but now I am getting


Any suggestion ?

Now after lots of debugging what I got is the signature generated by nodejs app gets connected successfully but when I generate with PHP it does not work. Can you give me some sample how to generate signature with PHP.

Hi got the success I was generating SDK signature JWT but I should have generated JWS . so now it is working thanks for all your support

1 Like

Glad to hear you are up and running, @iamtherealdp ! If you have any additional questions, please let us know.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.