# Can't generate correct web sdk signature in Laravel

**URL:** <https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584>\
**Category:** Web\
**Created:** [July 20, 2022, 8:39pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584 "2022-07-20T20:39:44Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![neoestudioguardiaciv](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@neoestudioguardiaciv](https://devforum.zoom.us/u/neoestudioguardiaciv)\
**Post date:** [July 20, 2022, 8:39pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/1 "2022-07-20T20:39:44Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [July 20, 2022, 10:05pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/2 "2022-07-20T22:05:53Z")

</div>

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

> **[SDK Authentication](https://marketplace.zoom.us/docs/sdk/native-sdks/auth/#generate-the-sdk-jwt)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

---

<div class="post-metadata">

**Author:** ![neoestudioguardiaciv](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@neoestudioguardiaciv](https://devforum.zoom.us/u/neoestudioguardiaciv)\
**Post date:** [July 21, 2022, 6:55am UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/3 "2022-07-21T06:55:18Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [July 21, 2022, 11:34am UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/4 "2022-07-21T11:34:42Z")

</div>

do you have updated ZoomMtg.join?

```auto
sdkKey: key;

```

> [@Web SDK with SDK App returns invalid signature](https://devforum.zoom.us/t/web-sdk-with-sdk-app-returns-invalid-signature/72000):
>
> Description With the impending JWT App depreciation we are looking to move SDK App type. I have been following the steps as provided here [https://marketplace.zoom.us/docs/sdk/native-sdks/web](https://marketplace.zoom.us/docs/sdk/native-sdks/web) and after generating SDK App type and using SDK App Key and Secret - i am getting the Invalid Signature error. The same code works with JWT App - but since JWT is being depreciated I am assuming SDK App Type should work ? Browser Console Error { "method": "join", "status": false, "result": …

Jürgen

---

<div class="post-metadata">

**Author:** ![neoestudioguardiaciv](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@neoestudioguardiaciv](https://devforum.zoom.us/u/neoestudioguardiaciv)\
**Post date:** [July 21, 2022, 1:44pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/5 "2022-07-21T13:44:07Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![neoestudioguardiaciv](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@neoestudioguardiaciv](https://devforum.zoom.us/u/neoestudioguardiaciv)\
**Post date:** [July 21, 2022, 2:52pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/6 "2022-07-21T14:52:55Z")

</div>

I’ve also used the exact same php code snippet provided here : [Generate Signature](https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature/)

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

But then I get ‘Invalid signature’ error.

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [July 21, 2022, 5:14pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/7 "2022-07-21T17:14:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![neoestudioguardiaciv](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@neoestudioguardiaciv](https://devforum.zoom.us/u/neoestudioguardiaciv)\
**Post date:** [July 21, 2022, 6:04pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/8 "2022-07-21T18:04:11Z")

</div>

We’re using the SDK JWT Signature.

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [July 21, 2022, 6:10pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/9 "2022-07-21T18:10:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![neoestudioguardiaciv](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@neoestudioguardiaciv](https://devforum.zoom.us/u/neoestudioguardiaciv)\
**Post date:** [July 21, 2022, 6:16pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/10 "2022-07-21T18:16:32Z")

</div>

Our backend developer has written it.

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

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [July 21, 2022, 6:19pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/11 "2022-07-21T18:19:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [July 21, 2022, 6:52pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/12 "2022-07-21T18:52:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![neoestudioguardiaciv](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@neoestudioguardiaciv](https://devforum.zoom.us/u/neoestudioguardiaciv)\
**Post date:** [July 21, 2022, 7:04pm UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/13 "2022-07-21T19:04:54Z")

</div>

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

```auto
 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
        ];
    }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [August 21, 2022, 5:05am UTC](https://devforum.zoom.us/t/cant-generate-correct-web-sdk-signature-in-laravel/72584/14 "2022-08-21T05:05:48Z")

</div>

Closed on August 21, 2022, 5:05am UTC

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