Error in Generation of Signature

I Cloned the Git hub Repo: GitHub - zoom/meetingsdk-react-sample: Use the Zoom Meeting SDK in React.

After setting up all the essential Parameters inside it, when I was joining the meeting. the following error was showing in the browser console :

  1. errorCode: 3712
  2. reason: “Signature is invalid.”
  3. type: “JOIN_MEETING_FAILED”

I checked the Signature on the JWT.IO also. The signature was verified. I don’t know what is the problem.

@rrph

do you have a sample of the JWT token?

This is my code for signature at server side :

app.post('/signature', (req, res) => {
    console.log('Request body:', req.body);
    const { meetingNumber, role } = req.body;

        const iat = Math.round(new Date().getTime() / 1000) - 30;
        const exp = iat + 60 * 60 * 2;

        const oHeader = { alg: 'HS256', typ: 'JWT' };

        const oPayload = {
            sdkKey: process.env.API_KEY,
            mn: meetingNumber,
            role: role,
            iat: iat,
            exp: exp,
            appKey: process.env.API_KEY,
            tokenExp: iat + 60 * 60 * 2
        };

        const sHeader = JSON.stringify(oHeader);
        const sPayload = JSON.stringify(oPayload);
        const signature = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, process.env.API_SECRET);

        res.json({ signature });

});

@rrph , this code looks ok.

Do you have the generated token?

There is a possibility when calling the API, the content-type in the POST is not set as application/json, causing the server side to receive “nothing” for meetingNumber and role

Having the generated token will help in troubleshooting

I had set the content-type correctly as : application/json. My token generated is : “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiI5WU81WExQU3ZXdWpxbmxIVWM3cUEiLCJpYXQiOjE3MDY4Njk1NTIsImV4cCI6MTcwNjg3Njc1MiwiYXBwS2V5IjoiOVlPNVhMUFN2V3VqcW5sSFVjN3FBIiwidG9rZW5FeHAiOjE3MDY4NzY3NTJ9.6-_BSle15I0LGCS0z2SXwyUVQ2k8SyKhMGLh4-2cBT8”.

@rrph Hope you will be fine.

Here is session about Zoom WebSDK Integration.

It is working now without changing anything. Don’t know what happened. Thank you for your support.