# PHP Invalid signature

**URL:** <https://devforum.zoom.us/t/php-invalid-signature/66898>\
**Category:** Meetings\
**Created:** [April 3, 2022, 3:27pm UTC](https://devforum.zoom.us/t/php-invalid-signature/66898 "2022-04-03T15:27:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tabe3.app.project](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@tabe3.app.project](https://devforum.zoom.us/u/tabe3.app.project)\
**Post date:** [April 3, 2022, 3:27pm UTC](https://devforum.zoom.us/t/php-invalid-signature/66898/1 "2022-04-03T15:27:31Z")

</div>

Hi,  
i used next php code to generate the signature

```auto
public static function generate_signature($api_key, $api_secret, $meeting_number, $role)
    {
        //Set the timezone to UTC
        date_default_timezone_set(config('app.timezone'));
        $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), '+/', '-_'), '=');
    }

```

but i received the next error

{type: ‘JOIN\_MEETING\_FAILED’, reason: ‘Signature is invalid.’, errorCode: 3712}

---

<div class="post-metadata">

**Author:** ![tabe3.app.project](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@tabe3.app.project](https://devforum.zoom.us/u/tabe3.app.project)\
**Post date:** [April 3, 2022, 3:30pm UTC](https://devforum.zoom.us/t/php-invalid-signature/66898/2 "2022-04-03T15:30:58Z")

</div>

the api\_key and api\_secret i get it from JWT credentials  
the metting number it is the id from the response of ([https://api.zoom.us/v2/users/](https://api.zoom.us/v2/users/)" . $zoomUserId . "/meetings)

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [April 23, 2022, 7:10am UTC](https://devforum.zoom.us/t/php-invalid-signature/66898/3 "2022-04-23T07:10:13Z")

</div>

Hi, @tabe3.app.project,

Welcome to the Developer Forum and thank you for posting. Are you able to share if you are the SDK API key and API secret?

 ![Screen Shot 2022-04-23 at 3.08.58 AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/b/0/b0af252a18cd798fcd2605b6e04b0f632c1ff830.png)

# Generate Signature

[https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature](https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature)
