Can't generate correct web sdk signature in Laravel

Description
We have written code in Firebase Laravel to generate signature for our react web sdk but whenever I click join meeting, I get Invalid SDKkey error in console. The meeting is already created and we just need to join it from our web app. I’ve check the SDK Key and meeting number many times, we’re also passing role:0 as we only want to join. We already have the pro version so that is no issue.

Browser Console Error

  1. {method: ‘join’, status: false, result: ‘Invalid sdkkey.’, errorMessage: ‘Failed to join meeting’, errorCode: 1}

  2. errorCode: 1

  3. errorMessage: “Failed to join meeting.”

  4. method: “join”

  5. result: “Invalid sdkkey.”

  6. status: false

Which Web Meeting SDK version?
Latest i.e. 2.5.0

Meeting SDK Code Snippets
public function generateJWTKey(Request $request) {
$key = $this->zoom_api_key;
$secret = $this->zoom_api_secret;
$meeting_number = $request->meetingNumber;
$role = $request->role;
$token = array(
“iss” => $key,
“exp” => time() + 3600, //60 seconds as suggested
“meetingNumber” => $meeting_number,
“role” => $role,
);
$encode = \Firebase\JWT\JWT::encode($token, $secret, ‘HS256’);

    return [
        'token'=>$encode
    ];
}

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

Screenshots

Device (please complete the following information):

  • Device: Hp Pavilion
  • OS: Windows 11
  • Browser: Chrome
  • Browser Version 103.0.5060.114 (Official Build) (64-bit)

Additional context
Add any other context about the problem here.

Hi @neoestudioguardiaciv
Thanks for reaching out to us!
Have you tried debugging your signature to make sure its valid?

Hi, thank you for getting back.

We did use postman to check it and we get a valid response in the same format as zoom asks 'header . payload . signature

This is just an example response (Have tweaked it here and there for security) : “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc5miOiJlak1VQzdzWkp4clJlRVo0aUxybGxXRDRpWXFNOVc2dE9xcd2iLCJleHAiOjE2NTgzMzy9OTQsIm1lZXRpbmdOdW1iZXIiOiI0mjY5NzYwGzG0Iiwicm9sZSIm6H0.rCrGvSxFSoVDwi9ynLccBaggJbVoW3YZW3dqOpGoTbs”

How can I further debug it ?

do you have updated ZoomMtg.join?

sdkKey: key;

Jürgen

Yes.

The same code works fine when I am generating signature from the sample node.js code. But not when we’re adding the php code on our backend…

I’ve also used the exact same php code snippet provided here : Generate Signature

The signature returned is (tweaked to prevent security breach): ZWpNVim3c1pKeHksZUVaNGlMcmxsV0Q0aVlxTTlXNnRPcXbTLjcyNjk3NjAzMzQuMTY1ODQxNDk1NDAwMC4wLnZvMWJDdVIzMFkwQ0FINlhBMmg5alVEpsFKdGFzTDJQMEMm4ytZNnU4S1E9

But then I get ‘Invalid signature’ error.

are you using JWT Signature (deprecated) or SDK JWT Signature ?

We’re using the SDK JWT Signature.

where does the php code come from - zoom doesn’t offer any for SDK JWT Signature (only for JWT Signature)

Our backend developer has written it.

Thank you so much for your response, we have just solved the issue 5 minutes ago.

1 Like

then it would be very nice to make the working php script available here - that would certainly help other developers a lot

1 Like

Thank you so much for chiming in @j.schoenemeyer and @neoestudioguardiaciv I am glad this issue was solved for now!

Yes, ofcourse.
We were able to generate the working signature using this script:

 public function generateJWTKey(Request $request) {

        $key = $this->zoom_api_key;
        $secret = $this->zoom_api_secret;
        $meeting_number = $request->meetingNumber;
        $role = $request->role;
        $token = array(
            "sdkKey" => $key,
            "mn" => $meeting_number,
            "role" => $role,
            "iat" => time(),
            "exp" => time() + 3600, //60 seconds as suggested
            "tokenExp" => time() + 3600,
        );
        $encode = \Firebase\JWT\JWT::encode($token, $secret, 'HS256');

        return [
            'token'=>$encode
        ];
    }
1 Like

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